当前位置:网站首页>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 );
边栏推荐
- Acwing: Game 58 of the week
- Raspberry pie 4b64 bit system installation miniconda (it took a few days to finally solve it)
- Spark独立集群动态上线下线Worker节点
- How to insert mathematical formulas in CSDN blog
- Codeforces round 797 (Div. 3) no f
- Generate random password / verification code
- (lightoj - 1323) billiard balls (thinking)
- 力扣——第298场周赛
- Discussion on QWidget code setting style sheet
- Chapter 5 yarn resource scheduler
猜你喜欢
ffmpeg命令行使用
两个礼拜速成软考中级软件设计师经验
本地可视化工具连接阿里云centOS服务器的redis
Browser print margin, default / borderless, full 1 page A4
Base dice (dynamic programming + matrix fast power)
MariaDB的安装与配置
Share an example of running dash application in raspberry pie.
QT有关QCobobox控件的样式设置(圆角、下拉框,向上展开、可编辑、内部布局等)
力扣——第298场周赛
Chapter 6 datanode
随机推荐
(lightoj - 1323) billiard balls (thinking)
Research Report on market supply and demand and strategy of China's four flat leadless (QFN) packaging industry
Codeforces Round #799 (Div. 4)A~H
Advancedinstaller installation package custom action open file
QT implementation window gradually disappears qpropertyanimation+ progress bar
Codeforces Round #801 (Div. 2)A~C
第 300 场周赛 - 力扣(LeetCode)
Educational Codeforces Round 130 (Rated for Div. 2)A~C
Base dice (dynamic programming + matrix fast power)
Investigation report of bench type Brinell hardness tester industry - market status analysis and development prospect prediction
图像处理一百题(1-10)
力扣leetcode第 280 场周赛
Some problems encountered in installing pytorch in windows11 CONDA
Raspberry pie 4b64 bit system installation miniconda (it took a few days to finally solve it)
js时间函数大全 详细的讲解 -----阿浩博客
Chapter 1 overview of MapReduce
MP4格式详解
Spark独立集群动态上线下线Worker节点
Research Report on market supply and demand and strategy of China's tetraacetylethylenediamine (TAED) industry
Codeforces - 1526C1&&C2 - Potions