AlfieriChou / alldate

Get all kind of date.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

alldate

Get all kind of date.

Installation

npm install alldate

In node.js

// es5
const AllDate = require('alldate')

// es6
import AllDate from 'alldate'

const time = new AllDate()
  • get Date now
console.log(time.date()) // 2018-12-16T14:03:10.314Z
  • get timestamp
console.log(time.timestamp()) // 1529992541992
  • get year
console.log(time.year()) // 2018
  • get month
console.log(time.month()) // 6
  • get day
console.log(time.day()) // 26
  • get chinese week
console.log(time.chWeek()) // 星期六
  • get english week
console.log(time.enWeek()) // saturday
  • get hour
console.log(time.hour()) // 13
  • get minutes
console.log(time.minutes()) // 59
  • get second
console.log(time.second()) // 27
  • get MD
console.log(time.MD()) // 06-30
  • get YMD
console.log(time.YMD()) // 2018-06-26
  • get YMDhms
console.log(time.YMDhms()) // 2018-06-26 13:59:27

About

Get all kind of date.

License:MIT License


Languages

Language:JavaScript 100.0%