zoukankan      html  css  js  c++  java
  • JS将时间对象输出为(12小时制和24小时制)的字符串

    JS将时间对象输出为(12小时制和24小时制)的字符串
    1、获取当前时间(12小时制和24小时制)
    var tempDate=new Date();// "Mon Sep 30 2019 20:38:03 GMT+0800 (中国标准时间)"
    var tempTimeStr12=tempDate.toLocaleString();// "2019/9/30 下午8:38:03"
    var tempTimeStr24=tempDate.toLocaleString('chinese', { hour12: false });// "2019/9/30 20:38:03"
    1
    2
    3


    2、获取当前时间(时分秒)(12小时制和24小时制)
    var tempDate=new Date();// "Mon Sep 30 2019 20:51:28 GMT+0800 (中国标准时间)"
    var tempTimeStr12=tempDate.toLocaleTimeString();// "下午8:51:28"
    var tempTimeStr24=tempDate.toLocaleTimeString('chinese', { hour12: false });// "20:51:28"
    1
    2
    3

    ————————————————
    版权声明:本文为CSDN博主「willingtolove」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/willingtolove/article/details/101791168

  • 相关阅读:
    子矩阵
    [Ahoi2008]Meet 紧急集合
    立体图
    CF933B A Determined Cleanup
    CF746G New Roads
    树的重量
    CF519E A and B and Lecture Rooms
    矩阵
    深入浅出乘法逆元
    20180519模拟赛T2——pretty
  • 原文地址:https://www.cnblogs.com/BlingSun/p/12868712.html
Copyright © 2011-2022 走看看