想将当前时间转化成自定义时间格式,xxxx中调用方法是
SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss", Locale.getDefault());
想将当前时间转化成自定义时间格式,xxxx中调用方法是
SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss", Locale.getDefault());
1 回答387 阅读✓ 已解决
1 回答449 阅读
405 阅读
398 阅读
355 阅读
372 阅读
319 阅读
可以使用三方库dayjs,下载安装:ohpm install dayjs。
使用: import dayjs from “dayjs”;
当前时间:dayjs().format(“YYYY-MM-DD HH:mm:ss”)
某个date: dayjs(date).format(“YYYY-MM-DD HH:mm:ss”)
可参考以下文档:https://gitee.com/openharmony-tpc/openharmony\_tpc\_samples/tree/master/dayjs
示例demo: