New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

dateformater

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dateformater

date format tool for both solar date and Chinese lunar date

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

dateformater

Node.js module to format date , support Chinese Lunar date #Installation ####Install dateformater in your project

  • npm install

      npm install dateformater  
    
  • use in project

      var dateformater = require('dateformater');
    

#Format pattern

####solar date

  • YYYY = long year(2015)

  • YY = short year(15)

  • MMMM = long month(November)

  • MMM = short month(Nov)

  • MM = month(01~12)

  • M = month(1~12)

  • DD = day(01~30)

  • D = day(1~30)

  • ddd = day in week in words(Saturday)

  • dd = short day in week in words(Sat)

####lunar date

  • YYY = lunar year in Chinese(庚辰年)

  • YY = lunar number long year(2000)

  • Y = lunar number short year(00)

  • MMMM = lunar month in Chinese(正月)

  • MM = lunar number long month(01)

  • M = lunar number short month(1)

  • DDD = lunar day in Chinese(初一)

  • DD = lunar number long day(01)

  • D = lunar number short day(1)

####time

  • HHH = hours(00~24)

  • HH = hours(0~24)

  • hhh = hours(00~12)

  • hh = hours(0~12)

  • mmm = minutes(00~59)

  • mm = minutes(0~59)

  • sss = minutes(00~59)

  • ss = minuts(0~59)

#Usage

var dateformater = require('dateformater');
var date = new Date();

(function(date){
  date.setFullYear(2000);
  date.setMonth(1);
  date.setDate(5);
  date.setHours(2);
  date.setMinutes(3);
  date.setSeconds(4);	
}(date));

###format

  • default

      //YYYY-MM-DD ddd hhh:mmm:sss
      dateformater.format(date);//output=>'2000-02-05 Saturday 02:03:04'
    
  • custom

      dateformater.format(date, 'YY-M-D dd hh:mm:ss')//output=>'00-2-5 Sat 2:3:4'  
    

###lunarFormat

  • default

      //YYY MMM DDD hhh:mmm:sss
      dateformater.lunarFormat(date);//output=>'庚辰年 正月 初一 02:03:04'
    
  • custom

      dateformater.lunarFormat(date, 'YY-MM-DD')//2000-01-01
    

#Test npm test #Welcome to improve my project

Keywords

date

FAQs

Package last updated on 24 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts