1.0.8 • Published 4 years ago

p-datetime v1.0.8

Weekly downloads
7
License
ISC
Repository
-
Last release
4 years ago

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|false|new Date()| | 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 |

1.0.8

4 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago