Skip to content

Instantly share code, notes, and snippets.

@yakubpashask
Created April 9, 2020 17:31
Show Gist options
  • Save yakubpashask/47f5f45bb959da0f3e042e30ad4b0365 to your computer and use it in GitHub Desktop.
Save yakubpashask/47f5f45bb959da0f3e042e30ad4b0365 to your computer and use it in GitHub Desktop.
final yesterday = DateTime(now.year, now.month, now.day); // today 12.00.00
final tomorrow = DateTime(now.year, now.month, now.day +1); //tomorrow 12.00.00
int diffInDays = tomorrow.difference(yesterday).inDays;
if (diffInDays == 0){
//custom code
print( "same day");
} else if( diffInDays > 0 ) {
// custom code
print("tomorrow is greater ");
} else{
// custom code
print(" yesterday is less" );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment