本文整理汇总了TypeScript中dateformat类的典型用法代码示例。如果您正苦于以下问题:TypeScript dateformat类的具体用法?TypeScript dateformat怎么用?TypeScript dateformat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了dateformat类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: log
public static log(level: string, message: string): void {
const time = dateformat(new Date(), 'HH:MM:ss');
console.log(`[${time} ${level}] ${message}`);
}
开发者ID:ha-dai,项目名称:Misskey,代码行数:4,代码来源:logger.ts
示例2: Date
/**
* https://github.com/felixge/node-dateformat#usage
*/
import * as dateFormat from 'dateformat'
const now = new Date()
// Basic usage
dateFormat(now, 'dddd, mmmm dS, yyyy, h:MM:ss TT')
// Saturday, June 9th, 2007, 5:46:21 PM
// You can use one of several named masks
dateFormat(now, 'isoDateTime')
// 2007-06-09T17:46:21
// ...Or add your own
dateFormat.masks['hammerTime'] = `HH:MM! "Can't touch this!"`
dateFormat(now, 'hammerTime')
// 17:46! Can't touch this!
// When using the standalone dateFormat function,
// you can also provide the date as a string
dateFormat('Jun 9 2007', 'fullDate')
// Saturday, June 9, 2007
// Note that if you don't include the mask argument,
// dateFormat.masks.default is used
dateFormat(now)
// Sat Jun 09 2007 17:46:21
// And if you don't include the date argument,
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:31,代码来源:dateformat-tests.ts
示例3: dateFormat
text = text.replace(this.getRegFindVarDoc(key), (match, p1, p2) => {
if (!p1 || (p1.toLowerCase() !== 'date'))
return variables[key];
else {
// replace date
if (!p2 || (p2.trim() === ''))
return variables.date.toLocaleDateString();
else
return dateFormat(variables.date, p2);
}
});
开发者ID:zabel-xyz,项目名称:plsql-language,代码行数:11,代码来源:pldoc.controller.ts
示例4: dateFormat
return new Promise<string>((resolve, reject) => {
jwt.sign(
{
Username: u.username + ' ' + u.lastname,
Scope: 'remote-console',
Exp: dateFormat(new Date().setDate(new Date().getDate() + 2), 'mm/dd/yyyy h:MM:ss'),
UserId: u.UUID,
BirthDate: new Date(u.created),
PartnerId: u.partner
},
cert,
{
algorithm: 'RS256',
noTimestamp: true
},
(err: Error, token: string) => {
if (err) return reject(err);
resolve(token);
}
);
})
开发者ID:M-O-S-E-S,项目名称:mgm,代码行数:21,代码来源:ConsoleHandler.ts
注:本文中的dateformat类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论