美文网首页
flutter dart 时间戳转时间

flutter dart 时间戳转时间

作者: 张漂亮1号 | 来源:发表于2020-01-18 15:30 被阅读0次
     var now = new DateTime.now();
        var format = new DateFormat('HH:mm a');
        var date = new DateTime.fromMillisecondsSinceEpoch(timestamp * 1000);
        var diff = now.difference(date);
        var time = '';
    
        if (diff.inSeconds <= 0 || diff.inSeconds > 0 && diff.inMinutes == 0 || diff.inMinutes > 0 && diff.inHours == 0 || diff.inHours > 0 && diff.inDays == 0) {
          time = format.format(date);
    
    image

    更多详解:
    喜欢可以加Q群号:913934649,点赞,评论;

    简书: https://www.jianshu.com/u/88db5f15770d

    csdn:https://me.csdn.net/beyondforme

    掘金:https://juejin.im/user/5e09a9e86fb9a016271294a7

    相关文章

      网友评论

          本文标题:flutter dart 时间戳转时间

          本文链接:https://www.haomeiwen.com/subject/wxwkzctx.html