1.0.1 • Published 5 years ago

date-format-lib v1.0.1

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

Date-lib

Help javascript users to get the formatted date string from the date

Build Status Coverage Status Codacy Badge License: MIT

Installing

npm install --save date-format-lib

Usage

When you use ES5

var DateLib = require('date-format-lib');

When you use ES6

import DateLib form 'date-format-lib';

Get today's date string with a giving pattern Assume today is March 16 1982

console.log(DateLib.getCurrentDateString('yyyy/mm/dd'));
// Output 1982/03/16
console.log(DateLib.getCurrentDateString('yyyy-mm-dd'));
// Output 1982-03-16
console.log(DateLib.getCurrentDateString('mm-dd-yyyy'));
// Output 03-16-1982
console.log(DateLib.getCurrentDateString('dd-mm-yyyy'));
// Output 16-03-1982
console.log(DateLib.getCurrentDateString('mm*dd&yyyy'));
// Output 03*16&1982

Get a giving date's string with a giving pattern You can use either a string or a Date object for the date source.

console.log(DateLib.getDateString('03/16/1982', 'yyyy/mm/dd'));
// Output 1982/03/16
console.log(DateLib.getDateString('03/16/1982', 'yyyy-mm-dd'));
// Output 1982-03-16
console.log(DateLib.getDateString(new Date('03/16/1982'), 'yyyy-mm-dd'));
// Output 1982-03-16

License

Date-lib is licensed under MIT License - see the License file.

1.0.1

5 years ago

1.0.0

5 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago