angular ts处理日期格式


引入DatePipe

import {DatePipe} from '@angular/common';  

添加provider

@Component({  
  providers: [DatePipe]
})

添加到构造方法中

  constructor(private datepipe: DatePipe) {

  }

使用:

this.datePipe.transform(_date,'yyyy-MM-DD') ;

 日期的比较:

var isTrue = new Date(date).getTime() > new Date().getTime();

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM