p-datetime

1.0.8 • Public • Published

# p-datetime 一款日期格式化工具

引入介绍(Introduction)

p-datetime主要用于日期格式化

npm i p-datetime
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <script src="../lib/datetime-format.js" type="text/javascript" charset="utf-8"></script> 
        <script type="text/javascript">
            let d = new DateTimeFormat();
            console.log(d.getDate(`YY-MM-DD APM HH12:m:s W `))
        </script> 
    </body>
</html>
  import DateTimeFormat from 'p-datetime';
  let d = new DateTimeFormat({
      datetime:new Date('2018-01-01'),
  });
  d.getDate(`YYYY-MM-DD HH12:mm:ss APM `)
  
  let d1 = new DateTimeFormat({
      datetime:new Date(),
      format:`YYYY-MM-DD HH12:mm:ss APM `
  });
  d1.getDate();
  let d2 = new DateTimeFormat();
  d1.getDate();

参数说明(Parameter description)

Introduction of constructor

prop type required default
datetime Date Number
format String false YYYY-MM-DD HH:mm:ss

Introduction of format

prop type info
YYYY String year
YY String year
MM String month
M String month
DD String date
D String date
HH String hour
HH24 String hour
HH12 String hour
H String hour
H24 String hour
H12 String hour
mm String minute
mi String minute
m String minute
ss String second
s String second
WW String week
W String week
APM String AP/PM

Package Sidebar

Install

npm i p-datetime

Weekly Downloads

0

Version

1.0.8

License

ISC

Unpacked Size

10.1 kB

Total Files

9

Last publish

Collaborators

  • keader