当前时间
export const nowTime = () => {
    const now = new Date();
    const year = now.getFullYear();
    const month = now.getMonth();
    const date = now.getDate() >= 10 ? now.getDate() : ('0' + now.getDate());
    const hour = now.getHours() >= 10 ? now.getHours() : ('0' + now.getHours());
    const miu = now.getMinutes() >= 10 ? now.getMinutes() : ('0' + now.getMinutes());
    const sec = now.getSeconds() >= 10 ? now.getSeconds() : ('0' + now.getSeconds());
    return +year + "年" + (month + 1) + "月" + date + "日 " + hour + ":" + miu + ":" + sec;
}
格式化时间
export const dateFormater = (formater, time) => {
    let date = time ? new Date(time) : new Date(),
        Y = date.getFullYear() + '',
        M = date.getMonth() + 1,
        D = date.getDate(),
        H = date.getHours(),
        m = date.getMinutes(),
        s = date.getSeconds();
    return formater.replace(/YYYY|yyyy/g, Y)
        .replace(/YY|yy/g, Y.substr(2, 2))
        .replace(/MM/g,(M<10 ? '0' : '') + M)
        .replace(/DD/g,(D<10 ? '0' : '') + D)
        .replace(/HH|hh/g,(H<10 ? '0' : '') + H)
        .replace(/mm/g,(m<10 ? '0' : '') + m)
        .replace(/ss/g,(s<10 ? '0' : '') + s)
}
// dateFormater('YYYY-MM-DD HH:mm:ss')
// dateFormater('YYYYMMDDHHmmss')
javascript根据相同id合并形成child子数组(支持低版本浏览器)
上面是“JavaScript开发小技巧之各种时间操作”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_1539.html
workflows工作流
 一只放屁虫甲虫ComfyUI工作流 一只放屁虫甲虫ComfyUI工作流
 森林里有一个皮肤像抛光黑曜石的生物 森林里有一个皮肤像抛光黑曜石的生物
 一个红头发明亮眼睛的漂亮女人 一个红头发明亮眼睛的漂亮女人
 完整海报生成comfyui工作流 完整海报生成comfyui工作流
 一个可爱的人形小机器人和一只蜗牛在森林 一个可爱的人形小机器人和一只蜗牛在森林
 一个超凡脱俗的女明星的特写镜头ComfyUI工作流 一个超凡脱俗的女明星的特写镜头ComfyUI工作流
 一个漂亮的混血女孩ComfyUI工作流 一个漂亮的混血女孩ComfyUI工作流
 图生图生成动漫效果ComfyUI工作流 图生图生成动漫效果ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

 3D彩色卡片
 3D彩色卡片 做一个好玩的时钟翻牌效果
 做一个好玩的时钟翻牌效果 Bootstrap可视化拖放布局
 Bootstrap可视化拖放布局 css3实现星球旋转
 css3实现星球旋转 css3结合svg做一个动态广告
 css3结合svg做一个动态广告 数字滚动效果(兼容IE6/IE8)
 数字滚动效果(兼容IE6/IE8) 用canvas实现画板涂鸦效果
 用canvas实现画板涂鸦效果 黑客入侵效果代码
 黑客入侵效果代码











