当前位置:网站首页>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 - 1526C1&&C2 - Potions
- 两个礼拜速成软考中级软件设计师经验
- Chapter 5 namenode and secondarynamenode
- VMware Tools和open-vm-tools的安装与使用:解决虚拟机不全屏和无法传输文件的问题
- Raspberry pie 4b64 bit system installation miniconda (it took a few days to finally solve it)
- Market trend report, technical innovation and market forecast of double-sided foam tape in China
- Codeforces Round #802(Div. 2)A~D
- 【锟斤拷】的故事:谈谈汉字编码和常用字符集
- Specify the format time, and fill in zero before the month and days
- Share an example of running dash application in raspberry pie.
猜你喜欢
Codeforces round 797 (Div. 3) no f
Kubernetes集群部署
MariaDB的安装与配置
【锟斤拷】的故事:谈谈汉字编码和常用字符集
OneForAll安装使用
Pytorch extract skeleton (differentiable)
Kubernetes cluster deployment
第5章 消费者组详解
Story of [Kun Jintong]: talk about Chinese character coding and common character sets
The concept of spark independent cluster worker and executor
随机推荐
Installation and use of VMware Tools and open VM tools: solve the problems of incomplete screen and unable to transfer files of virtual machines
Chapter 2 shell operation of hfds
Market trend report, technical innovation and market forecast of China's desktop capacitance meter
Codeforces - 1526C1&&C2 - Potions
Chapter 6 rebalance details
VMware Tools和open-vm-tools的安装与使用:解决虚拟机不全屏和无法传输文件的问题
Codeforces Round #798 (Div. 2)A~D
Solve the problem of intel12 generation core CPU [small core full, large core onlookers] (win11)
浏览器打印边距,默认/无边距,占满1页A4
QT模拟鼠标事件,实现点击双击移动拖拽等
China double brightening film (dbef) market trend report, technical dynamic innovation and market forecast
300th weekly match - leetcode
AcWing——第55场周赛
新手必会的静态站点生成器——Gridsome
875. Leetcode, a banana lover
QT realizes window topping, topping state switching, and multi window topping priority relationship
Tert butyl hydroquinone (TBHQ) Industry Research Report - market status analysis and development prospect forecast
Study notes of Tutu - process
OneForAll安装使用
第2章 HFDS的Shell操作