Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

flutter compare dates

DateTime dt1 = DateTime.parse("2021-12-23 11:47:00");
DateTime dt2 = DateTime.parse("2018-02-27 10:09:00");

if(dt1.compareTo(dt2) == 0){
    print("Both date time are at same moment.");
}

if(dt1.compareTo(dt2) < 0){
    print("DT1 is before DT2");
}

if(dt1.compareTo(dt2) > 0){
    print("DT1 is after DT2");
}
Source by www.fluttercampus.com #
 
PREVIOUS NEXT
Tagged: #flutter #compare #dates
ADD COMMENT
Topic
Name
8+2 =