代码之家  ›  专栏  ›  技术社区  ›  heyr

颤振dd/mm/yyyy hh:mm中的日期时间格式

  •  5
  • heyr  · 技术社区  · 7 年前

    My Date-Time format at the moment is this

    通过使用这个:

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

    我正在获取图片中所附的格式类型,但我想知道是否可以将其加入 dd/MM/YYYY hh:mm ??

    3 回复  |  直到 7 年前
        1
  •  14
  •   vbandrade    7 年前

    如果你使用 intl package :

    final f = new DateFormat('yyyy-MM-dd hh:mm');
    
    Text(f.format(new DateTime.fromMillisecondsSinceEpoch(values[index]["start_time"]*1000)));
    
        2
  •  1
  •   Vinoth Kumar    7 年前

    你可以使用 date_format 此处提供插件 https://pub.dartlang.org/packages/date_format

    然后转换,

    formatDate(DateTime.now(), [dd, '/', mm, '/', yyyy, ' ', HH, ':', nn])
    
        3
  •  0
  •   SilenceCodder    6 年前
    final df = new DateFormat('dd-MM-yyyy hh:mm a');
     int myvalue = 1558432747;
      print(df.format(new DateTime.fromMillisecondsSinceEpoch(myvalue*1000)));
    

    产量

    2019年5月21日上午10:59