当前位置:网站首页>Introduction to date object
Introduction to date object
2022-07-22 19:28:00 【Please call me Gerald 6】
Date object , stay js Use in Date Object to represent a time
Create a Date object , If you directly use the constructor to create a Date object , Will be encapsulated as the current code execution time
var d = new Date()
Create an object at a specified time , You need to pass a time string as an argument in the constructor
The format of the date : month / year / when : branch : second
var d = new Date("12/03/2020 10:10:10");
Date() Object method
1.getDate() Get the date of the current object
2.getDay() Gets the current date of the week , Will return a 0~6 Value ,0 It means Monday ,1 Tuesday , And so on …
3.getMonth() Gets the month of the current time object , Will return a 0~11 Value ,0 Means January ,1 It means February , And so on …
4.getFullYear() Gets the year of the current date object
5.getTime() Gets the timestamp of the current date object , Time stamp , It refers to... From Greenwich mean time 1970 year 1 month 1 Japan ,0 when 0 branch 0 second , The number of milliseconds taken to the current date (1 second = 1000 millisecond ), Because of the year , month , The time base of the day is not unified , So the computer in order to unify the time base , When saving the time at the bottom, the millisecond stamp is used
6.now() Get the timestamp of the current code execution , It is often used to test the running time of code
边栏推荐
猜你喜欢
Flutter's first program Hello world!
Flutter premier programme Hello world!
Flutter 第一個程序Hello World!
JVM tuning practice - start from scratch | summary of JVM tuning related to the project
4G工业路由器大气环境监测方案
2022 centos8 Yum image installation & Alibaba cloud MySQL 5.7 tutorial and problem solving
软件产业未来发展的几个趋势
[yolov5 practice 4] traffic sign recognition system based on yolov5 - model test and evaluation
工业路由器油田无线监控
融云漫话:没有一个人躲得过“视频会议”
随机推荐
Constructor
Programmer interview golden code interview question 01.04. palindrome arrangement
LeetCode 每日一题 2021/12/13-2021/12/19
4G工业路由器大气环境监测方案
This points to the problem
Centos7 installs MySQL 5.7 decompressed version & Navicat connection MySQL & firewall settings - the personal test is valid
融云首席科学家任杰:历练出人才,职场「经历>经验」
Nacos persistent connection MySQL database SM4 encryption scheme
什么是“实时”
Transformer, another city! The top of many low-level tasks was occupied, and Peking University Huawei and others jointly proposed the pre training model IPT
Flutter's first program Hello world!
Audio 3A processing practice makes your application more "pleasant"
mysql5.7解压版配置步骤
Swagger-UI介绍及常用注解说明
JVM tuning practice - start from scratch | summary of JVM tuning related to the project
LeetCode 每日一题 2021/11/22-2021/11/28
LeetCode 每日一题 2022/3/7-2022/3/13
Ps: how to call up auxiliary lines
Ten year structure five year Life-05 first business trip
LeetCode 每日一题 2021/12/20-2021/12/26