3h-time 中文文档教程

发布于 6年前 浏览 24 项目主页 更新于 3年前

3h-time

时间格式化程序。

Install

npm i 3h-time

APIs

Time.format(date: Date, format: string): string

格式化给定的日期。

Time.get(format: string):string

等于 Time.format(new Date(), format)

Time.replacers: { [id: string]: (date: Date) => string; }

替换地图。

Replace map

  • YYYY - Full year.
  • YY - Short year.
  • MMMM - Full month name.
  • MMM - Short month name.
  • MM - Month number with leading zero.
  • M - Month number without leading zero.
  • DD - Date number with leading zero.
  • D - Date number without leading zero.
  • dd - Date number with st/nd/rd/th and leading zero.
  • d - Date number with st/nd/rd/th but without leading zero.
  • HH - Hour(0-23) with leading zero.
  • H - Hour(0-23) without leading zero.
  • hh - Hour(0-11) with leading zero.
  • h - Hour(0-11) without leading zero.
  • mm - Minutes with leading zero.
  • m - Minutes without leading zero.
  • SS - Seconds with leading zero.
  • S - Seconds without leading zero.
  • sss - Full milliseconds with leading zero.
  • ss - Shorter milliseconds.
  • s - Shortest milliseconds.
  • WW - Full day name.
  • W - Short day name.
  • ww - Full day number.
  • w - Short day number.
  • A - AM/PM.
  • a - am/pm.

Changelog

请参阅 CHANGELOG.md

3h-time

A time formatter.

Install

npm i 3h-time

APIs

Time.format(date: Date, format: string): string

Format the given date.

Time.get(format: string):string

Equal to Time.format(new Date(), format).

Time.replacers: { [id: string]: (date: Date) => string; }

A replacer map.

Replace map

  • YYYY - Full year.
  • YY - Short year.
  • MMMM - Full month name.
  • MMM - Short month name.
  • MM - Month number with leading zero.
  • M - Month number without leading zero.
  • DD - Date number with leading zero.
  • D - Date number without leading zero.
  • dd - Date number with st/nd/rd/th and leading zero.
  • d - Date number with st/nd/rd/th but without leading zero.
  • HH - Hour(0-23) with leading zero.
  • H - Hour(0-23) without leading zero.
  • hh - Hour(0-11) with leading zero.
  • h - Hour(0-11) without leading zero.
  • mm - Minutes with leading zero.
  • m - Minutes without leading zero.
  • SS - Seconds with leading zero.
  • S - Seconds without leading zero.
  • sss - Full milliseconds with leading zero.
  • ss - Shorter milliseconds.
  • s - Shortest milliseconds.
  • WW - Full day name.
  • W - Short day name.
  • ww - Full day number.
  • w - Short day number.
  • A - AM/PM.
  • a - am/pm.

Changelog

See CHANGELOG.md.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文