本文整理汇总了TypeScript中moment/moment.utc函数的典型用法代码示例。如果您正苦于以下问题:TypeScript utc函数的具体用法?TypeScript utc怎么用?TypeScript utc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utc函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: extractConferenceListData
private extractConferenceListData(res: Response): Conference[] {
let body: any = res.json();
let conferenceList: Conference[] = [];
if (body) {
for (let x: number = 0; x < body.length; x++) {
let conference = new Conference();
conference.id = body[x].id;
conference.name = body[x].name;
conference.location = body[x].location;
conference.startDate = new Date(body[x].startDate);
conference.startDateStr = Moment.utc(conference.startDate).format('MM/DD/YYYY');
conference.endDate = new Date(body[x].endDate);
conference.endDateStr = Moment.utc(conference.endDate).format('MM/DD/YYYY');
conference.city = body[x].city;
conference.state = body[x].state;
conferenceList.push(conference);
}
}
return conferenceList;
}
示例2:
.then(arr => {
let retArr = [arr[0]];
for (let i=1; i < arr.length; i++) {
let dateStr = arr[i].split(' to ');
let fromTime = moment.utc(dateStr[0], 'YYYY-MM-DD HH:mm:ss Z').unix() * 1000;
let toTime = moment.utc(dateStr[1], 'YYYY-MM-DD HH:mm:ss Z').unix() * 1000;
retArr.push((toTime - fromTime) + '');
}
return retArr;
});
示例3: transform
transform(value) : string {
if (!value) {
return '';
}
let gmtDateTime = moment.utc(value);
return gmtDateTime.local().format("ddd MMM DD YYYY HH:mm:ss");
}
示例4: extractConferenceData
private extractConferenceData(res: Response): Conference {
let body: Conference = res.json();
if (body) {
let conference = new Conference();
conference.id = body.id;
conference.name = body.name;
conference.location = body.location;
conference.startDate = body.startDate;
conference.startDateStr = Moment.utc(conference.startDate).format('YYYY-MM-DD');
conference.endDate = body.endDate;
conference.endDateStr = Moment.utc(conference.endDate).format('YYYY-MM-DD');
conference.city = body.city;
conference.state = body.state;
return conference;
} else {
return new Conference();
}
}
示例5: constructor
constructor() {
super();
this.nativeValue = utc();
}