Is there any way in dart to find next and previous weekday name? Such as, today is say Friday, so previous day was Thursday and next day will Saturday. Can I programmatically handle that?

Solution 1: Ivo

At the time I posted this it's Thursday where I live

For yesterday:

print(DateFormat("EEEE").format( -1))));



For tomorrow:

print(DateFormat("EEEE").format( 1))));



The output might be different depending on your locale.

This needs

import 'package:intl/intl.dart';

to work.

Solution 2: Sadhik

in your pubspec.yaml file, dependencies section. add intl dependency like so

  intl: ^latest version

and then import :

import 'package:intl/intl.dart';

now you can use DateFormat as you wish, here is an example :

print(DateFormat('EEEE').format(; // prints Tuesday
print(DateFormat('EEEE').format( 1))));// prints Monday
print(DateFormat('EEEE').format( 1)))); // prints Wednesday