1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > angular4 获取当前日期(年月日) 根据当前日期判断星期几

angular4 获取当前日期(年月日) 根据当前日期判断星期几

时间:2021-01-15 11:57:41

相关推荐

angular4 获取当前日期(年月日) 根据当前日期判断星期几

ngOnInit(): void {this.now = new Date();this.week = this.transform(this.now);}//获取当前时间 判断是星期几transform(value: any): any {if (value !== undefined) {let weekArray = new Array('周日', '周一', '周二', '周三', '周四', '周五', '周六');let myDate = new Date(value);let week = weekArray[myDate.getDay()];return week;}}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。