本文整理匯總了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();
}