当前位置:网站首页>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 );
边栏推荐
- Raspberry pie 4b64 bit system installation miniconda (it took a few days to finally solve it)
- Spark独立集群Worker和Executor的概念
- 第5章 NameNode和SecondaryNameNode
- Kubernetes cluster deployment
- QT implementation window gradually disappears qpropertyanimation+ progress bar
- Local visualization tools are connected to redis of Alibaba cloud CentOS server
- Bisphenol based CE Resin Industry Research Report - market status analysis and development prospect forecast
- 去掉input聚焦时的边框
- 提交Spark应用的若干问题记录(sparklauncher with cluster deploy mode)
- AcWing:第56场周赛
猜你喜欢
Codeforces Round #802(Div. 2)A~D
Chapter 5 detailed explanation of consumer groups
Solve the problem that intel12 generation core CPU single thread only runs on small cores
Tree of life (tree DP)
第2章 HFDS的Shell操作
Installation and use of VMware Tools and open VM tools: solve the problems of incomplete screen and unable to transfer files of virtual machines
业务系统从Oracle迁移到openGauss数据库的简单记录
Some problems encountered in installing pytorch in windows11 CONDA
(lightoj - 1369) answering queries (thinking)
第5章 NameNode和SecondaryNameNode
随机推荐
Effet d'utilisation, déclenché lorsque les composants de la fonction sont montés et déchargés
Chapter 2 shell operation of hfds
第 300 场周赛 - 力扣(LeetCode)
Research Report on hearing health care equipment industry - market status analysis and development prospect prediction
软通乐学-js求字符串中字符串当中那个字符出现的次数多 -冯浩的博客
Solve the problem of intel12 generation core CPU [small core full, large core onlookers] (win11)
Submit several problem records of spark application (sparklauncher with cluster deploy mode)
生成随机密码/验证码
计算时间差
(lightoj - 1369) answering queries (thinking)
AcWing——第55场周赛
Bidirectional linked list - all operations
Codeforces Round #801 (Div. 2)A~C
(lightoj - 1349) Aladdin and the optimal invitation (greed)
Chapter III principles of MapReduce framework
解决Intel12代酷睿CPU单线程调度问题(二)
Browser print margin, default / borderless, full 1 page A4
第5章 消费者组详解
Generate random password / verification code
Spark's RDD (elastic distributed data set) returns a large result set