1.1.3 • Published 2 years ago

moka-moment v1.1.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

About

You can use the package methoed format your time,and you can also copy the code where you need it

Install

npm install moka-moment

Import

const moment = require("moka-moment")

Super simple to use

yyyy: Get four-digit year === 2022 / yy: Get two-digit year === 22

MM: Get month(padding zero) === 01 / M: Get month(without padding zero) === 1

dd: Get date(padding zero) === 01 / d: Get date(without padding zero) === 1

hh: Get hours(padding zero) === 00 / h: Get hours(without padding zero) === 0

mm: Get minutes(padding zero) === 00 / m: Get minutes(without padding zero) === 0

ss: Get seconds(padding zero) === 00 / s: Get seconds(without padding zero) === 0

S: Get milliseconds === 999

Code demonstration

    // Make sure you have installed moka-moment
    const moment = require("moka-moment")
    let nowTime = moment.dateFormat("yyyy-MM-dd hh:mm:ss S")
    console.log(nowTime)   // 2022-01-01 01:01:01 999 

    let nowTime = moment.dateFormat("M-d hh:mm:ss")
    console.log(nowTime)   // 1-1 01:01:01 

license

ISC