Extend class of Date
Install
npm install datetimes --save
Usage
nodejs - basic usage
'use strict'const Datetimes = ;var date = ;console; //result:// Tue Apr 03 2018 10:34:41 GMT-0300 (Hora oficial do Brasil) {}
Browser - basic usage
Document
Functions
-
format(stringFormat, [options]): string
var date = 2017 2 22;date; // 22/03/2017var date2 = 2017 2 22;date2;// wednesday 22 march 2017- stringFormats:
- year
- 01/01/2017 - yyyy => 2017
- 01/01/2017 - yyy => 017
- 01/01/2017 - yy => 17
- month
- 01/01/2017 - MMMM => janeiro
- 01/01/2017 - MMM => jan
- 01/01/2017 - MM => 01
- 01/01/2017 - M => 1
- day:
- 01/01/2017 - dddd => domingo
- 01/01/2017 - ddd => dom
- 01/01/2017 - dd => 01
- 01/01/2017 - d => 1
- hour:
- 13:30:07 - HH => 13
- 13:30:07 - h => 3
- minute:
- 13:05:07 - mm => 05
- second:
- 13:05:07 - ss => 07
- millisecond:
- 13:05:07:123 - zzz => 123
- year
- options: possibles values "pt-BR", "es-MX" or "en-US"
- stringFormats:
-
now(): Datetimes
var date = ;date // datetime => date time actual
- noTimeZone(): Datetimes
var Datetime = ;Datetime // Will return the date 22/03/2017 without time zone