Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alfierichou/alldate
Get all kind of date.
https://github.com/alfierichou/alldate
Last synced: about 1 month ago
JSON representation
Get all kind of date.
- Host: GitHub
- URL: https://github.com/alfierichou/alldate
- Owner: AlfieriChou
- License: mit
- Created: 2018-06-26T04:03:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-28T09:19:31.000Z (about 6 years ago)
- Last Synced: 2024-12-19T00:11:53.709Z (about 1 month ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# alldate
Get all kind of date.### Installation
```
npm install alldate
```### In node.js
```javascript
// es5
const AllDate = require('alldate')// es6
import AllDate from 'alldate'const time = new AllDate()
```* get Date now
```javascript
console.log(time.date()) // 2018-12-16T14:03:10.314Z
```* get timestamp
```javascript
console.log(time.timestamp()) // 1529992541992
```* get year
```javascript
console.log(time.year()) // 2018
```* get month
```javascript
console.log(time.month()) // 6
```* get day
```javascript
console.log(time.day()) // 26
```* get chinese week
```javascript
console.log(time.chWeek()) // 星期六
```* get english week
```javascript
console.log(time.enWeek()) // saturday
```* get hour
```javascript
console.log(time.hour()) // 13
```* get minutes
```javascript
console.log(time.minutes()) // 59
```* get second
```javascript
console.log(time.second()) // 27
```* get MD
```javascript
console.log(time.MD()) // 06-30
```* get YMD
```javascript
console.log(time.YMD()) // 2018-06-26
```* get YMDhms
```javascript
console.log(time.YMDhms()) // 2018-06-26 13:59:27
```