【问题标题】:flutter convert date string to int颤振将日期字符串转换为int
【发布时间】:2023-04-07 06:07:01
【问题描述】:

这里我想以yy/MM/dd hh:mm的格式显示日期但出现错误

类型 'String' 不是类型 'int' 的子类型

final f = new DateFormat('yy/MM/dd hh:mm');

然后

TextSpan(text: f.format(new DateTime.fromMillisecondsSinceEpoch(item["transaction_date"]*1000))),

并且已经尝试使用date format 但它仍然是一个错误,同样的错误

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    我猜你的 item["transaction_date"] 是字符串。尝试解析:int.parse(item["transaction_date"])

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-26
      • 2020-08-11
      • 2021-09-29
      • 2011-04-22
      • 2020-02-08
      • 1970-01-01
      • 2015-04-27
      • 1970-01-01
      相关资源
      最近更新 更多