Created
August 22, 2022 15:39
-
-
Save pjbelo/93281c9ce61e871f0b633d33214ccff4 to your computer and use it in GitHub Desktop.
print weekday name (v2) [dart]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension DateTimeExtension on DateTime { | |
String? weekdayName() { | |
const Map<int, String> weekdayName = {1: "Monday", 2: "Tuesday", 3: "Wednesday", 4: "Thursday", 5: "Friday", 6: "Saturday", 7: "Sunday"}; | |
return weekdayName[weekday]; | |
} | |
} | |
void main() { | |
print(DateTime.now().weekdayName()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment