当前位置:网站首页>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 );
边栏推荐
- Anaconda下安装Jupyter notebook
- Market trend report, technical innovation and market forecast of China's desktop capacitance meter
- Raspberry pie 4B installation opencv3.4.0
- Double specific tyrosine phosphorylation regulated kinase 1A Industry Research Report - market status analysis and development prospect prediction
- <li>圆点样式 list-style-type
- Chapter 1 overview of MapReduce
- Codeforces Round #798 (Div. 2)A~D
- 新手必会的静态站点生成器——Gridsome
- Useeffect, triggered when function components are mounted and unloaded
- 生成随机密码/验证码
猜你喜欢

Problem - 922D、Robot Vacuum Cleaner - Codeforces

Tree of life (tree DP)

Raspberry pie 4b64 bit system installation miniconda (it took a few days to finally solve it)

【锟斤拷】的故事:谈谈汉字编码和常用字符集

第 300 场周赛 - 力扣(LeetCode)

Browser print margin, default / borderless, full 1 page A4

antd upload beforeUpload中禁止触发onchange

QT实现窗口渐变消失QPropertyAnimation+进度条

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

解决Intel12代酷睿CPU【小核载满,大核围观】的问题(WIN11)
随机推荐
Market trend report, technical innovation and market forecast of tabletop dishwashers in China
Chapter 2 shell operation of hfds
Problem - 922D、Robot Vacuum Cleaner - Codeforces
Codeforces Round #802(Div. 2)A~D
(POJ - 1458) common subsequence (longest common subsequence)
Pull branch failed, fatal: 'origin/xxx' is not a commit and a branch 'xxx' cannot be created from it
QT有关QCobobox控件的样式设置(圆角、下拉框,向上展开、可编辑、内部布局等)
Kubernetes cluster deployment
Research Report on market supply and demand and strategy of Chinese table lamp industry
QT实现圆角窗口
Market trend report, technical innovation and market forecast of China's desktop capacitance meter
Market trend report, technical innovation and market forecast of double-sided foam tape in China
QT实现窗口渐变消失QPropertyAnimation+进度条
Market trend report, technological innovation and market forecast of China's double sided flexible printed circuit board (FPC)
Educational Codeforces Round 130 (Rated for Div. 2)A~C
Codeforces Round #801 (Div. 2)A~C
Study notes of Tutu - process
sublime text 代码格式化操作
Chapter III principles of MapReduce framework
【锟斤拷】的故事:谈谈汉字编码和常用字符集