Socket
Socket
Sign inDemoInstall

date-time

Package Overview
Dependencies
1
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    date-time

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


Version published
Weekly downloads
796K
decreased by-2.28%
Maintainers
1
Install size
8.87 kB
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 20 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc