Created with <3 with dartpad.dev.
Created
August 12, 2022 18:55
-
-
Save Apostata/703bcd2d9c60378abae253890c530a49 to your computer and use it in GitHub Desktop.
loth-flash-9362
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
void main() { | |
// String text = '04/08/1984'; | |
// final textSplited = text.split('/'); | |
// final date = DateTime.parse('${textSplited[2]}-${textSplited[1]}-${textSplited[0]}'); | |
// print(date.millisecondsSinceEpoch); | |
// final dateMili = date.millisecondsSinceEpoch; | |
// final teste = DateTime.fromMillisecondsSinceEpoch(dateMili); | |
// final date2 = teste.millisecondsSinceEpoch; | |
// print(date2); | |
final now = DateTime.now(); | |
final oldDate = DateTime.fromMillisecondsSinceEpoch(460436400000); | |
final utcDate = DateTime.parse("1980-03-24T00:00:00Z"); | |
final weekFirstDay = now.subtract(Duration(days: 7)); | |
final weekLastDay = | |
now; | |
final beginingOfWeek = DateTime(weekFirstDay.year, weekFirstDay.month, weekFirstDay.day); | |
final endOfWeek = DateTime(weekLastDay.year, weekLastDay.month, weekLastDay.day); | |
print('weekFirstDay:$beginingOfWeek, weekLastDay:$endOfWeek'); | |
// double hourAndMinutesToDecimal(String hhmm) { | |
// List<String> splitedHHmm = hhmm.split(':'); | |
// double hours = double.parse(splitedHHmm[0]); | |
// double minutes = ((double.parse(splitedHHmm[1]) / 60)*100).truncate()/100; | |
// double result = hours + minutes; | |
// return result; | |
// } | |
// print(hourAndMinutesToDecimal('72:34')*120); | |
print(now.toUtc()); | |
print(oldDate.toUtc()); | |
print(utcDate); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment