当前位置:网站首页>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 );
边栏推荐
- MP4格式详解
- Research Report on market supply and demand and strategy of double drum magnetic separator industry in China
- < li> dot style list style type
- Codeforces - 1526C1&&C2 - Potions
- 力扣leetcode第 280 场周赛
- OneForAll安装使用
- 计算时间差
- Problem - 922D、Robot Vacuum Cleaner - Codeforces
- 解决Intel12代酷睿CPU【小核载满,大核围观】的问题(WIN11)
- AcWing——第55场周赛
猜你喜欢

Codeforces Round #801 (Div. 2)A~C

使用jq实现全选 反选 和全不选-冯浩的博客

提交Spark应用的若干问题记录(sparklauncher with cluster deploy mode)

图像处理一百题(1-10)

Kubernetes cluster deployment

解决Intel12代酷睿CPU【小核载满,大核围观】的问题(WIN11)

Chapter 5 namenode and secondarynamenode

Discussion on QWidget code setting style sheet

Spark独立集群动态上线下线Worker节点

Codeforces Round #799 (Div. 4)A~H
随机推荐
Log statistics (double pointer)
Local visualization tools are connected to redis of Alibaba cloud CentOS server
Useeffect, triggered when function components are mounted and unloaded
Kubernetes集群部署
Chapter 5 detailed explanation of consumer groups
Effet d'utilisation, déclenché lorsque les composants de la fonction sont montés et déchargés
AcWing——第55场周赛
Chapter III principles of MapReduce framework
<li>圆点样式 list-style-type
Bisphenol based CE Resin Industry Research Report - market status analysis and development prospect forecast
Codeforces round 797 (Div. 3) no f
Read and save zarr files
Market trend report, technological innovation and market forecast of desktop electric tools in China
第6章 Rebalance详解
Codeforces Round #771 (Div. 2)
Market trend report, technical innovation and market forecast of China's desktop capacitance meter
FLV格式详解
Investigation report of bench type Brinell hardness tester industry - market status analysis and development prospect prediction
Codeforces Round #800 (Div. 2)AC
Calculate the time difference