Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

tz-format

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tz-format

Format a date with timezone

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
939
17.67%
Maintainers
1
Weekly downloads
 
Created
Source

tz-format Build Status

Format a date with timezone: 2015-11-30T10:40:35+01:00

Install

$ npm install --save tz-format

Usage

const format = require('tz-format');

format();
//=> '2015-11-30T10:40:35+01:00'

format(0);
//=> '2015-11-30T09:40:35+00:00'

format(new Date());
//=> '2015-11-30T10:40:35+01:00'

format(new Date(), 0);
//=> '2015-11-30T09:40:35+00:00'

format(new Date(2015, 11, 25, 11, 0, 0, 0), -1);
//=> '2015-12-25T09:00:00-01:00'

API

format([date], [offset])

input

Type: date
Default: new Date()

Date to be formatted.

offset

Type: number

Offset from UTC in hours.

License

MIT © Sam Verschueren

Keywords

datetime

FAQs

Package last updated on 06 Oct 2016

Did you know?

Socket

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