标签:size 相等 本地 ssi sig rom 字符 print 定时
var now=new DateTime.now();
print(now.millisecondsSinceEpoch); //单位毫秒,13位时间戳
var now=new DateTime.now();
var a=now.millisecondsSinceEpoch; // 时间戳
print(DateTime.fromMillisecondsSinceEpoch(a));
DateTime assignDay = new DateTime(2020,10,10);
print(assignDay); // 2020-10-10 00:00:00.000
// 例如计算1天14小时45分的跨度
Duration timeRemaining = new Duration(days:1, hours:14, minutes:45);
print(timeRemaining); // 38:45:00.000000
DateTime.parse(‘2019-11-08‘) 或者 DateTime.parse(‘2019-11-08 12:30:05‘)
var today = DateTime.now();
var date = DateTime.parse("2019-06-20 15:32:41");
today.isBefore(date);
var today = DateTime.now();
var date = DateTime.parse("2019-06-20 15:32:41");
today.isAfter(date);
var today = DateTime.now();
var date = DateTime.parse("2019-06-20 15:32:41");
today.isAtSameMomentAs(date);
var today = DateTime.now(); // 2019-11-08 02:54:53.218443
var fiftyDaysFromNow = today.add(new Duration(days: 5));
print(‘today加5天:$fiftyDaysFromNow‘); // today加5天:2019-11-13 02:54:53.218443
var today = DateTime.now(); // 2019-11-08 02:54:53.218443
var fiftyDaysAgo = today.add(new Duration(days: 5));
print(‘today加5天:$fiftyDaysAgo ‘); // today减5天:2019-11-03 02:54:53.218443
var day2 = new DateTime(2019, 7, 21, 0, 0, 0);
print(‘比较两个时间 差 小时数:${day1.difference(day2)}‘); // 比较两个时间 差 小时数:-726:29:40.000000
year、month、day、weekday、hour、minute、second、millisecond、microsecond
var today = DateTime.now();
print(today.year);
print(‘本地时区简码:${today.timeZoneName}‘); // 本地时区简码:GMT
DateTime today = DateTime.now();
print(‘返回UTC与本地时差 小时数:${today.timeZoneOffset}‘);
标签:size 相等 本地 ssi sig rom 字符 print 定时
原文地址:https://www.cnblogs.com/www3j/p/11818972.html