当前位置:网站首页>JS time function Daquan detailed explanation ----- AHAO blog
JS time function Daquan detailed explanation ----- AHAO blog
2022-07-06 16:39:00 【Feng Hao (grow up)】
date 、 Time object
date 、 Time object is used to save date and time , Save time in a specific time period , from 1970 Year forward or backward 285616 year ,UTC It's Greenwich mean time , Also known as universal time .
Instantiate Date object :var date = new Date ( );
Timestamp of one year :var yearTimeStamp = 3652460601000;
Set date time var date = new Date ( 2018,1,1 )
var date = new Date(“1/1/2018 11:30:30”);
1、 Component method
1、 Get full year getFullYear ( );
2、 Set full year setFullYear ( );
3、 Get month getMonth ( ); Value range :0-11
4、 Set month setMonth ( );
5、 Get date getDate ( ); Value range :1-31
6、 Setting date setDate ( );
7、 Get week getDay ( ); Value range :0-6
8、 For hours getHours ( ); Value range :0-23
9、 Set hours setHours ( );
10、 Get minutes getMinutes ( ); Value range :0-59
11、 Set minutes setMinutes ( );
12、 Get seconds getSeconds ( ); Value range :0-59
13、 Set seconds setSeconds ( );
14、 Get milliseconds getMillionSeconds ( ); Value range :0-999
15、 Set milliseconds setMillionSeconds ( );
Component methods have a corresponding UTC.
function : Get the day of the week on the first day of the specified year
function getweek(year,month){
return new Date(year,month-1).getDay;
}console.log(getweek(2017,10));
2、 Time timer
1、 Set time timer setInterval ( function ( ){ }, The time interval ( In milliseconds ) );
2、 Clear time timer clearInterval ( Timer name );
边栏推荐
- Codeforces Round #802(Div. 2)A~D
- (POJ - 1458) common subsequence (longest common subsequence)
- Date plus 1 day
- QT style settings of qcobobox controls (rounded corners, drop-down boxes, up expansion, editable, internal layout, etc.)
- Some problems encountered in installing pytorch in windows11 CONDA
- QT模拟鼠标事件,实现点击双击移动拖拽等
- 拉取分支失败,fatal: ‘origin/xxx‘ is not a commit and a branch ‘xxx‘ cannot be created from it
- Click QT button to switch qlineedit focus (including code)
- Solve the problem that intel12 generation core CPU single thread only runs on small cores
- Chapter 2 shell operation of hfds
猜你喜欢

QT有关QCobobox控件的样式设置(圆角、下拉框,向上展开、可编辑、内部布局等)

Remove the border when input is focused

Chapter 5 detailed explanation of consumer groups

Chapter 1 overview of MapReduce

QT simulates mouse events and realizes clicking, double clicking, moving and dragging

Chapter 5 namenode and secondarynamenode

Installation and configuration of MariaDB

Advancedinstaller安装包自定义操作打开文件

Hbuilder X格式化快捷键设置

antd upload beforeUpload中禁止触发onchange
随机推荐
图图的学习笔记-进程
第5章 NameNode和SecondaryNameNode
原生js实现全选和反选的功能 --冯浩的博客
(POJ - 1458) common subsequence (longest common subsequence)
Pytorch extract skeleton (differentiable)
Advancedinstaller安装包自定义操作打开文件
Chapter 5 detailed explanation of consumer groups
The "sneaky" new asteroid will pass the earth safely this week: how to watch it
< li> dot style list style type
antd upload beforeUpload中禁止触发onchange
Input can only input numbers, limited input
Chapter 7__ consumer_ offsets topic
Codeforces Round #797 (Div. 3)无F
Kubernetes cluster deployment
Specify the format time, and fill in zero before the month and days
QT实现窗口渐变消失QPropertyAnimation+进度条
CMake Error: Could not create named generator Visual Studio 16 2019解决方法
Raspberry pie 4B installation opencv3.4.0
Spark's RDD (elastic distributed data set) returns a large result set
Investigation report of bench type Brinell hardness tester industry - market status analysis and development prospect prediction