时间中间键总结
来源:互联网 发布:上海大学乐乎论坛圈子 编辑:程序博客网 时间:2024/05/01 13:51
一下内容是对数据接口返回的时间节点处理方法很管用的哦
记得收藏
import { Pipe, PipeTransform } from '@angular/core';@Pipe({ name: 'interval'})export class IntervalPipe implements PipeTransform { transform(value: any): any { let date = new Date(value) if (!date) { return '' } let now = new Date() let year = now.getFullYear() - date.getFullYear() if (year) { return year + '年前' } let month = now.getMonth() - date.getMonth() if (month) { return month + '月前' } let day = now.getDate() - date.getDate() if (day) { return day + '天前' } let hour = now.getHours() - date.getHours() if (hour) { return hour + '小时前' } let min = now.getMinutes() - date.getMinutes() if (min) { return min + '分钟前' } return '刚刚'; }}
阅读全文
0 0
- 时间中间键总结
- 中间交付个人总结
- 计算开始时间,结束时间 中间间隔毫秒数
- java根据开始时间结束时间计算中间间隔日期
- Android中间键开发
- [sql server] 问题总结8- 中间变量
- Qemu中间代码微指令类型总结
- js 从开始和结束时间得到中间所有天
- c# json 日期中间有T 国际标准时间
- 软考总结之总结、网络、中间代码
- 按选择的开始时间和结束时间算出中间的所有年月日
- Adnroid long类型时间戳时间转换-常用/中间带英文等
- 从以前任意的时间到现在的时间并获取中间的年月
- java c# 基础总结的,中间还有问题
- 约束规划建模技巧总结---中间变量和全局约束
- 阿里天池中间比赛总结,即消息队列引擎设计
- PyTorch学习总结(一)——查看模型中间结果
- 给一个开始时间和一个结束时间,求中间的连续时间(用java实现)?
- 简单学习struts标签中使用ognl表达式
- jquery
- 16 Three.js使用dat.GUI简化试验流程
- yum安装gcc和gcc-c++
- HDU 2276-Kiki & Little Kiki 2(矩阵快速幂+位运算)
- 时间中间键总结
- Hybrid APP混合开发的一些经验和总结
- mysql事务隔离性
- Hadoop HDFS 运行原理
- 集合
- CDN(静态独立)
- 加载
- 华为经典C语言面试题(一)
- Java需要掌握的常用类库