date-time
Pretty datetime: `2014-01-09 06:46:01`
Last updated 5 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install date-time 
SYNC missed versions from official npm registry.

date-time

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

Install

$ npm install date-time

Usage

import dateTime from '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.

Current Tags

  • 4.0.0                                ...           latest (5 years ago)

9 Versions

  • 4.0.0                                ...           5 years ago
  • 3.1.0                                ...           7 years ago
  • 3.0.0                                ...           7 years ago
  • 2.1.0                                ...           9 years ago
  • 2.0.0                                ...           9 years ago
  • 1.1.0                                ...           10 years ago
  • 1.0.0                                ...           12 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (3)

Copyright 2013 - present © cnpmjs.org | Home |