当前位置: 首页 > news >正文

网站开发项目答辩ppt广州疫情最新数据

网站开发项目答辩ppt,广州疫情最新数据,移动互联网开发是干什么的,wordpress静态资源加载不flutter开发实战-时间显示刚刚几分钟前几小时前 在开发中经常遇到从服务端获取的时间戳,需要转换显示刚刚、几分钟前、几小时前、几天前、年月日等格式。 一、代码实现 static String timeFormatterChatTimeStamp(int seconds) {try {int nowDateSeconds (DateTi…

flutter开发实战-时间显示刚刚几分钟前几小时前

在开发中经常遇到从服务端获取的时间戳,需要转换显示刚刚、几分钟前、几小时前、几天前、年月日等格式。

一、代码实现

static String timeFormatterChatTimeStamp(int seconds) {try {int nowDateSeconds =(DateTime.now().millisecondsSinceEpoch / 1000).truncate();String anotherDate =DateUtil.formatDateMs(seconds*1000, format: DateFormats.full);String nowDate =DateUtil.formatDateMs(nowDateSeconds*1000, format: DateFormats.full);print("timeFormatterChatTimeStamp ""seconds:${seconds},""nowDateSeconds:${nowDateSeconds},""anotherDate:${anotherDate},""nowDate:${nowDate}");//为了判断当前时间是否为未来时间if (seconds > nowDateSeconds) {return anotherDate;}List<String> anotherDateList = anotherDate.split(" ");List<String> nowDateList = nowDate.split(" ");if (anotherDateList.length == 2 && nowDateList.length == 2) {String nowDateYMD = nowDateList[0];String nowDateHMS = nowDateList[1];String anotherDateYMD = anotherDateList[0];String anotherDateHMS = anotherDateList[1];List<String> anotherDateYMDList = anotherDateYMD.split("-");List<String> nowDateYMDList = nowDateYMD.split("-");List<String> anotherDateHMSList = anotherDateHMS.split(":");List<String> nowDateHMSList = nowDateHMS.split(":");String anotherDateY = anotherDateYMDList[0];String anotherDateM = anotherDateYMDList[1];String anotherDateD = anotherDateYMDList[2];String nowDateY = nowDateYMDList[0];String nowDateM = nowDateYMDList[1];String nowDateD = nowDateYMDList[2];String anotherDateH = anotherDateHMSList[0];String anotherDateMi = anotherDateHMSList[1];String anotherDateS = anotherDateHMSList[2];int year = int.parse(anotherDateY) - int.parse(nowDateY);if (year < 0) {// 过去(今年以前)return "${anotherDateY}${anotherDateM}${anotherDateD}${anotherDateH}:${anotherDateMi}";} else {if (nowDateY == anotherDateY) {// 今年return "${anotherDateM}${anotherDateD}${anotherDateH}:${anotherDateMi}";} else {return "${anotherDateY}${anotherDateM}${anotherDateD}${anotherDateH}:${anotherDateMi}";}}} else {return anotherDate;}} catch (e) {return "${seconds}";}}

二、小结
flutter开发实战-格式化时间显示刚刚几分钟前几小时前等

从服务端获取的时间戳,需要转换显示刚刚、几分钟前、几小时前、几天前、年月日等格式。用到了DateUtil。

学习记录,每天不停进步。

http://www.hkea.cn/news/707884/

相关文章:

  • 加网络网站建设工作室做一个企业网站大概需要多少钱
  • 张家港优化网站seo百度网盘下载
  • 烟台有没有做网站网站安全
  • 网站建设与制作设计公司惠州seo代理商
  • 东营新闻网今日头条常州网站seo
  • 东莞全网合一网站黄页引流推广网站软件免费
  • wordpress的数据库在那里百度seo如何快速排名
  • wordpress手机客服代码免费seo快速排名工具
  • web网站开发作品关键词歌词图片
  • 汕头行业网站seo培训公司
  • 网站背景图片优化关键词歌曲免费听
  • 郑州做网站哪家专业我要发布信息
  • 西安做网站优化的公司石家庄seo按天扣费
  • 2022年西安封城通知自动app优化下载
  • 无锡做网站哪家公司好一个公司可以做几个百度推广
  • 专题网站建设工作关键词林俊杰无损下载
  • adobe 网站开发软件软文写作兼职
  • 英文网站建设 淮安免费培训网站
  • 隔离需要多少钱湖南网站seo找行者seo
  • wordpress简单企业站seo怎么刷排名
  • 网站建设与运维泉州全网推广
  • 网站建站哪个公司好一点营销咨询服务
  • 值得玩的网页游戏北京seo营销培训
  • 中国建设银行网站分期通百度推广登录平台网址
  • 公司内部网站源码新闻软文推广案例
  • vf建设银行网站谷歌seo排名
  • 如何申请商业服务器武汉seo工厂
  • 祥云平台英文网站微博指数查询入口
  • 公司网站建设准备资料今日重大财经新闻
  • 发布网站后备案免费网站建站页面