1.1.8 • Published 2 years ago

@riversun/simple-date-format v1.1.8

Weekly downloads
53
License
MIT
Repository
github
Last release
2 years ago

simple-date-format

npm version CircleCI codecov Codacy Badge License: MIT

Simple Date Formater for JavaScript. It allows for formatting date → text .

You can easily format date with specific patterns like as follows.

yyyyMMdd'T'HHmmssXX20180717T120856+0900

live demo is here

install

use node.js/npm

install module

npm install @riversun/simple-date-format

import module

import SimpleDateFormat from "@riversun/simple-date-format";

or

require module

const SimpleDateFormat = require('@riversun/simple-date-format');

use with \<script>tag from CDN

<script src="https://cdn.jsdelivr.net/npm/@riversun/simple-date-format/lib/simple-date-format.js"></script>

usage

const date = new Date('2018/07/17 12:08:56');
const sdf = new SimpleDateFormat();
console.log(sdf.formatWith("yyyy-MM-dd'T'HH:mm:ssXXX", date));//to be "2018-07-17T12:08:56+09:00"
const date = new Date('2018/07/17 12:08:56');
const sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
console.log(sdf.format(date));//to be "2018-07-17T12:08:56+09:00"

Pattern of the date

The following examples show how date and time patterns are interpreted. The given date and time are 2018-07-17 12:08:56 local time in Tokyo/Japan time zone.

Examples

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.4

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago