Skip to content

Instantly share code, notes, and snippets.

@pjbelo
Created August 22, 2022 15:39
Show Gist options
  • Save pjbelo/93281c9ce61e871f0b633d33214ccff4 to your computer and use it in GitHub Desktop.
Save pjbelo/93281c9ce61e871f0b633d33214ccff4 to your computer and use it in GitHub Desktop.
print weekday name (v2) [dart]
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