您可以使用day.js库来获取当前时间。以下是一个例子:

// 引入day.js库
import dayjs from 'dayjs';

// 获取当前时间
const now = dayjs();

// 输出当前时间
console.log(now.format('YYYY-MM-DD HH:mm:ss'));

这将打印出当前时间的格式化字符串,例如:2022-03-31 15:47:21

您还可以使用day.js的其他功能来格式化、比较和操作日期和时间。有关更多信息,请参阅day.js文档。

day js 插件获取当前时间

原文地址: https://www.cveoy.top/t/topic/byl6 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录