当前位置:网站首页>js基础--Date对象
js基础--Date对象
2022-06-11 09:14:00 【夺笋123】
创建对象
语法格式
//创建一个日期时间对象
var mydate=new Date();
操作年、月、日
获取时间的方法
| 方法 | 范围 | |
|---|---|---|
| 年 | getFullYear() | 四位数字的年份 |
| 月 | getMonth() | 0-12 |
| 日 | getDate() | 1-31 |
| 星期 | getDay() | 0-6 |
设置时间的方法
| 方法 | 描述 | 注意 |
|---|---|---|
| setFullYear(year,month,day) | 设置年、月、日 | year为必选参数 |
| setMonth(month,day) | 设置月、日 | month为必选参数 |
| setDate(day) | 设置日 | day为必选参数 |
操作时、分、秒
获取时间的方法
| 方法 | 范围 | |
|---|---|---|
| 小时 | getHours() | 0-23 |
| 分钟 | getMinutes() | 0-59 |
| 秒 | getSeconds() | 0-59 |
| 毫秒 | getMilliseconds() | 0-999 |
| 时间戳 | getTime() |
设置时间的方法
| 方法 | 描述 | 注意 |
|---|---|---|
| setHours(hour,min,sec,millisec) | 设置时、分、秒、毫秒 | hour为必选参数 |
| setMinutes(min,sec,millisec) | 设置分、秒、毫秒 | min为必选参数 |
| setSeconds(sec,millisec) | 设置秒、毫秒 | sec为必选参数 |
边栏推荐
- Machine learning notes - spatial transformer network using tensorflow
- 小型制氧机解决方案PCBA电路板开发
- Machine learning notes - convolutional neural network memo list
- 工厂出产流程中的这些问题,应该怎么处理?
- Runtimeerror: blobreader error:the version of imported blob doesn't match graph_ transformer
- [scheme design] scheme of household oximeter based on single chip microcomputer
- PCBA方案定制,开发腕式血压计方案
- What problems can ERP system help enterprises deal with?
- Machine learning notes - in depth Learning Skills Checklist
- Fabric. JS dynamically set font size
猜你喜欢
![Error [detectionnetwork (1)][warning]network compiled for 6 shapes, maximum available 10, compiling for 5 S](/img/54/f42146ae649836fe7070ac90f2160e.png)
Error [detectionnetwork (1)][warning]network compiled for 6 shapes, maximum available 10, compiling for 5 S

【ROS】noedic-moveit安装与UR5模型导入

Some learning records I=

Augmented reality experiment IV of Shandong University

Exclusive interview with PMC member Liu Yu: female leadership in Apache pulsar community

Redis source code analysis hash object (z\u hash)

实现边充边OTG的PD芯片GA670-10

Machine learning notes - spatial transformer network using tensorflow

Pulsar job Plaza | Tencent, Huawei cloud, shrimp skin, Zhong'an insurance, streamnational and other hot jobs

Day39 process object and other method mutexes
随机推荐
【分享】企业如何进行施行规划?
A summary of the problem type and method for proving the limit of sequence in postgraduate entrance examination
Type-C蓝牙音箱单口可充可OTG方案
Package details
How to deal with these problems in the factory production process?
面试题 17.10. 主要元素
Customize PCBA scheme and develop wrist sphygmomanometer scheme
OpenCV CEO教你用OAK(四):创建复杂的管道
Concurrent programming
Openstack explanation (21) -- installation and configuration of neutron components
2161. divide the array according to the given number
openstack详解(二十三)——Neutron其他配置、数据库初始化与服务启动
Exclusive interview with PMC member Liu Yu: female leadership in Apache pulsar community
Day39 process object and other method mutexes
【方案开发】血压计方案压力传感器SIC160
Opencv CEO teaches you to use oak (IV): create complex pipelines
1400. construct K palindrome strings
报错[error] input tesnor exceeds available data range [NeuralNetwork(3)] [error] Input tensor ‘0‘ (0)
The mobile terminal page uses REM for adaptation
Set up redis highly available cluster environment