当前位置:网站首页>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 );
边栏推荐
- Li Kou - 298th weekly match
- (POJ - 3186) treatments for the cows (interval DP)
- QT有关QCobobox控件的样式设置(圆角、下拉框,向上展开、可编辑、内部布局等)
- input 只能输入数字,限定输入
- Research Report on market supply and demand and strategy of double drum magnetic separator industry in China
- 875. Leetcode, a banana lover
- Market trend report, technological innovation and market forecast of desktop electric tools in China
- 第 300 场周赛 - 力扣(LeetCode)
- Codeforces Round #802(Div. 2)A~D
- 300th weekly match - leetcode
猜你喜欢
顺丰科技智慧物流校园技术挑战赛(无t4)
第5章 消费者组详解
视频压缩编码和音频压缩编码基本原理
Discussion on QWidget code setting style sheet
(lightoj - 1369) answering queries (thinking)
拉取分支失败,fatal: ‘origin/xxx‘ is not a commit and a branch ‘xxx‘ cannot be created from it
Solve the problem that intel12 generation core CPU single thread only runs on small cores
Codeforces Round #799 (Div. 4)A~H
Local visualization tools are connected to redis of Alibaba cloud CentOS server
Advancedinstaller installation package custom action open file
随机推荐
Codeforces Round #801 (Div. 2)A~C
简单尝试DeepFaceLab(DeepFake)的新AMP模型
Spark独立集群Worker和Executor的概念
China double brightening film (dbef) market trend report, technical dynamic innovation and market forecast
Useeffect, triggered when function components are mounted and unloaded
Double specific tyrosine phosphorylation regulated kinase 1A Industry Research Report - market status analysis and development prospect prediction
Codeforces Round #799 (Div. 4)A~H
第5章 消费者组详解
Codeforces Round #803 (Div. 2)A~C
Codeforces Round #800 (Div. 2)AC
(lightoj - 1236) pairs forming LCM (prime unique decomposition theorem)
Base dice (dynamic programming + matrix fast power)
Problem - 922D、Robot Vacuum Cleaner - Codeforces
日期加1天
Bidirectional linked list - all operations
力扣leetcode第 280 场周赛
Codeforces Round #771 (Div. 2)
Research Report on market supply and demand and strategy of Chinese table lamp industry
OneForAll安装使用
Effet d'utilisation, déclenché lorsque les composants de la fonction sont montés et déchargés