1.0.3 • Published 4 years ago

js-datetime-plus v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

js-datetime-plus

DateTime simple object

Usage

a) Parsing

const dateTimeYMD = DateTime.parse("2020-10-05 10:05:20");
const dateTimeDMY = DateTime.parse("05/10/2020 10:05:20");
const timeHMS = Time.parse("10:05:20");
const timeHM = Time.parse("10:05");

b) Formating

const date = new DateTime(2020,10,5,10,5,20);

date.toString() // "2020-10-05 10:05:20"
date.toYMDString() // "2020-10-05"
date.toDMYString() // "05/10/2020"
date.toString('hm') // "10:05"
date.time.toHMString() // "10:05"
date.time.toHMSString() // "10:05:20"

c) Adding

const dateTime = new DateTime(2020,10,5,10,5,20);

const dateTimeAdded3Days = date.addDays(3);
const dateTimeSubtracted7hours = dateTime.addHours(-7);
1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago