codeql-action/node_modules/date-time
github-actions[bot] 0da815296a Update checked-in dependencies 2022-02-24 17:03:29 +00:00
..
index.d.ts Fix dependabot issues 2021-10-25 08:56:16 -07:00
index.js Fix dependabot issues 2021-10-25 08:56:16 -07:00
license Fix dependabot issues 2021-10-25 08:56:16 -07:00
package.json Update checked-in dependencies 2022-02-24 17:03:29 +00:00
readme.md Fix dependabot issues 2021-10-25 08:56:16 -07:00

readme.md

date-time Build Status

Pretty datetime: 2014-01-09 06:46:01

Install

$ npm install date-time

Usage

const dateTime = require('date-time');

dateTime();
//=> '2017-05-20 17:07:05'

dateTime({date: new Date(1989, 2, 4, 10)});
//=> '1989-03-04 09:00:00'

dateTime({showTimeZone: true});
//=> '2017-05-20 17:07:05 UTC+7'

dateTime({local: false});
//=> '2017-05-20 10:07:05'

dateTime({local: false, showTimeZone: true});
//=> '2017-05-20 10:07:05 UTC'

dateTime({showMilliseconds: true});
//=> '2017-05-20 17:07:05 6ms'

API

dateTime([options])

options

Type: Object

date

Type: Date
Default: new Date()

Custom date.

local

Type: boolean
Default: true

Show the date in the local time zone.

showTimeZone

Type: boolean
Default: false

Show the UTC time zone postfix.

showMilliseconds

Type: boolean
Default: false

Show the milliseconds in the date if any.

License

MIT © Sindre Sorhus