博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
在JavaScript中以Hours24:Minutes:Seconds格式获取当前时间
阅读量:2530 次
发布时间:2019-05-11

本文共 765 字,大约阅读时间需要 2 分钟。

使用JavaScript获取当前时间 (Getting current time in JavaScript)

To get the current time in JavaScript, we need to use three library functions of Date class,

获取JavaScript中的当前时间 ,我们需要使用Date类的三个库函数,

  1. – It returns current hours

    –返回当前时间

  2. – It returns current minutes

    –返回当前分钟

  3. – It returns current seconds

    –返回当前秒数

Note: To call these functions, we need to create an object to the Date class using .

注意:要调用这些函数,我们需要使用为Date类创建一个对象。

Examples:

例子:

Date class constructor:    var dt = new Date();    Function calls:    dt.getHours();    dt.getMinues();    dt.getSeconds();        Output:    20    12    35

JavaScript code to get the current time in Hours24: Minutes: Seconds format

JavaScript代码以Hours24:Minutes:Seconds格式获取当前时间

JavaScipt Example

Output

输出量

Current time is= 20:12:35

翻译自:

转载地址:http://akxzd.baihongyu.com/

你可能感兴趣的文章
jpg转bmp(使用libjpeg)
查看>>
linear-gradient常用实现效果
查看>>
sql语言的一大类 DML 数据的操纵语言
查看>>
VMware黑屏解决方法
查看>>
JS中各种跳转解析
查看>>
JAVA 基础 / 第八课:面向对象 / JAVA类的方法与实例方法
查看>>
Ecust OJ
查看>>
P3384 【模板】树链剖分
查看>>
Thrift源码分析(二)-- 协议和编解码
查看>>
考勤系统之计算工作小时数
查看>>
4.1 分解条件式
查看>>
Equivalent Strings
查看>>
flume handler
查看>>
收藏其他博客园主写的代码,学习加自用。先表示感谢!!!
查看>>
H5 表单标签
查看>>
su 与 su - 区别
查看>>
C语言编程-9_4 字符统计
查看>>
在webconfig中写好连接后,在程序中如何调用?
查看>>
限制用户不能删除SharePoint列表中的条目(项目)
查看>>
【Linux网络编程】使用GDB调试程序
查看>>