Skip to content
On this page

formatToDateTime

将给定的日期格式化为指定格式的日期和时间字符串。

引入方式

ESM

javascript
import { formatToDateTime } from "tool-assistant;

示例

javascript
// 引入 formatToDateTime 函数
import { formatToDateTime } from "tool-assistant";

// 要格式化的日期
const date = new Date();

// 格式化为日期和时间的字符串
const formattedDateTime = formatToDateTime(date);

// 打印格式化的日期和时间
console.log(formattedDateTime);

Released under the MIT License.