1.0.1 • Published 2 years ago
times_formatting v1.0.1
times_formatting
快速上手
安装
npm i times_formatting --save-dev
描述及使用方法
import { parseTime } from "times_formatting";
/**
* @param {new Date()} 可以为new Date()也可以为具体的时间戳
* @param {{y}-{m}-{d} {h}:{i}:{s}} 想返回的格式
*/
const time = parseTime(new Date(), "{y}-{m}-{d} {h}:{i}:{s}");
console.log("time", time); //2023-03-13 09:41:29
const time2 = parseTime(new Date(), "{y}-{m}-{d} ");
console.log("time", time2); //2023-03-13