New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

datwo

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datwo

Datetime format and compare

  • 0.7.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-78.57%
Maintainers
1
Weekly downloads
 
Created
Source

Datwo

Datwoime format and compare

Table of Content

  • Installation
  • Usage
  • API

Installation

npm i datwo

Usage

datwo can override vanilla Date class

Format

ESM

import Date from 'datwo';

console.log(new Date().format('YYYY-MM-DD hh:mm:ss'));
console.log(new Date().format('YY-M-D N h:m:s.CC'));
console.log(new Date().format('YYYY / DDD / sssss / CCC'));

CJS

const Date = require('datwo').default;

console.log(new Date().format('YYYY-MM-DD hh:mm:ss'));
console.log(new Date().format('YY-M-D N h:m:s.CC'));
console.log(new Date().format('YYYY / DDD / sssss / CCC'));
Result
2022-09-25 14:30:00
22-9-25 PM 2:30:0.02
2022 / 267 / 52200 / 023

Format Characters

CharsMeaningExample
YYYY4 digit Year2022
YY2 digit Year22
MM2 digit Month (0#)09
M1-2 digit Month9
DDD3 digit Day (00#) (in year)237
DD2 digit Day (0#)07
D1-2 digit Day7
hh2 digit Hour (0#)08
h1-2 digit Hour8
hhhh2 digit Hour (0#) (in 12 hours)08
hhh1-2 digit Hour (in 12 hours)8
mm2 digit Minute (0#)03
m1-2 digit Minute3
sssss5 digit Second (in day)04363
ss2 digit Second (0#)09
s1-2 digit Second9
CCC3 digit Milisecond (00#)123
CC2 digit Milisecond (0#)12
C1 digit Milisecond1
Tnew Date().getTime()1664076951031
NAM / PMAM
NK오전 / 오후오전
GTime words of dayMorning
GK시간대를 나타내는 단어아침

Compare

console.log(new Date('2022-01-02 00:00:00').compare(new Date('2021-12-29 00:05:00')));
console.log(new Date('2022-01-02 00:00:00').compare(new Date('2022-01-01 00:10:00')));
console.log(new Date('2022-01-02 00:00:00').compare(new Date('2022-01-01 24:53:00')));
console.log(new Date('2022-01-02 00:00:00.000').compare(new Date('2022-01-01 24:59:59.256')));
Result
사흘 전
23시간 전
7분 전
744밀리초 전

Keywords

FAQs

Package last updated on 11 Feb 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc