facebook twitter hatena line email

「Flutter/日時」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(unixtime)
(x日前)
 
(同じ利用者による、間の2版が非表示)
行2: 行2:
 
  int unixtime = DateTime.now().toUtc().millisecondsSinceEpoch;
 
  int unixtime = DateTime.now().toUtc().millisecondsSinceEpoch;
 
  print("unixtime=$unixtime"); // unixtime=1557085819211
 
  print("unixtime=$unixtime"); // unixtime=1557085819211
 +
 +
DateTime dd = new DateTime.fromMillisecondsSinceEpoch(unixtime);
 +
print("date=$dd"); // date=2019-05-06 04:56:30.237
 +
print("date:${dd.toString().substring(0,16)}"); // date=2019-05-06 04:56
  
 
==x日前==
 
==x日前==
 
https://stackoverflow.com/questions/50632217/dart-flutter-converting-timestamp
 
https://stackoverflow.com/questions/50632217/dart-flutter-converting-timestamp
 +
 +
==日付フォーマット変更==
 +
https://quickstartflutterdart.blogspot.com/2018/10/how-to-convert-string-to-date-and-date.html

2019年5月6日 (月) 05:24時点における最新版

unixtime

int unixtime = DateTime.now().toUtc().millisecondsSinceEpoch;
print("unixtime=$unixtime"); // unixtime=1557085819211
DateTime dd = new DateTime.fromMillisecondsSinceEpoch(unixtime);
print("date=$dd"); // date=2019-05-06 04:56:30.237
print("date:${dd.toString().substring(0,16)}"); // date=2019-05-06 04:56

x日前

https://stackoverflow.com/questions/50632217/dart-flutter-converting-timestamp

日付フォーマット変更

https://quickstartflutterdart.blogspot.com/2018/10/how-to-convert-string-to-date-and-date.html