Date Time format in Flutter dd/MM/YYYY hh:mm

前端 未结 6 1086
耶瑟儿~
耶瑟儿~ 2020-12-28 14:10

By using this :

Text(new DateTime.fromMillisecondsSinceEpoch(values[index][\"start_time\"]*1000).toString(), 

I am getting the ty

6条回答
  •  -上瘾入骨i
    2020-12-28 14:55

    First install the pub.dev/packages/intl package in your pubspec.yaml

       intl: ^0.16.1
    

    Then use

       final df = new DateFormat('dd-MM-yyyy hh:mm a');
       int myvalue = 1558432747;
       print(df.format(new DateTime.fromMillisecondsSinceEpoch(myvalue*1000)));
    

    Output

    21-05-2019 10:59 AM

提交回复
热议问题