当前位置:网站首页>Get hours, minutes and seconds
Get hours, minutes and seconds
2022-07-26 02:24:00 【Hide roses on your back】
Get the timestamp
// Get the timestamp
function getTime() {
const timezone = 8; // Target time zone time , East eight Positive number of Eastern time zone Negative number of Xishi District
const offset_GMT = new Date().getTimezoneOffset(); // The difference between local time and Greenwich mean time , In minutes
const nowDate = new Date().getTime(); // Local time interval 1970 year 1 month 1 Midnight (GMT Time ) The number of milliseconds between
const targetDate = new Date(
nowDate + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000
);
const time = targetDate.getTime();
return time;
}Get the timestamp
Date.now()
1658748281671Gets the minutes and seconds of the year, month and day
// Get date Minutes and seconds
getCurrentTime() {
var myDate = new Date();
var nowDate =
myDate.getFullYear() +
"-" +
(myDate.getMonth() + 1) +
"-" +
myDate.getDate() + " "+ myDate.getHours()+ ":"+myDate.getMinutes()+':'+myDate.getSeconds()
const cunrentTime = nowDate;
return cunrentTime
},Get date Minutes and seconds And the current day of the week
function time() {
var vWeek, vWeek_s, vDay;
vWeek = [" Sunday ", " Monday ", " Tuesday ", " Wednesday ", " Thursday ", " Friday ", " Saturday "];
var date = new Date();
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
hours = date.getHours();
minutes = date.getMinutes();
seconds = date.getSeconds();
vWeek_s = date.getDay();
console.log( year + " year " + month + " month " + day + " Japan " + "\t" + hours + ":" + minutes + ":" + seconds + "\t" + vWeek[vWeek_s]);
};
setInterval("time()", 1000);
边栏推荐
- I.MX6UL核心模块使用连载-TF卡读写测试 (五)
- 【云原生】4.1 DevOps基础与实战
- Effectively solve the problem of garbled code when idea runs the web project (with detailed steps)
- Product thinking drives the construction of R & D management tools
- 1. Mx6ul core module serial use - touch screen calibration (IX)
- 微信小程序解密并拆包获取源码教程
- [2020] [paper notes] growth of bi2te3/cofeb double-layer heterojunction by magnetron sputtering——
- Keil's operation before programming with C language
- 博云容器云、DevOps 平台斩获可信云“技术最佳实践奖”
- 1. Mx6ul core module serial WiFi test (VIII)
猜你喜欢

1. Mx6ul core module use serial RTC test (XII)

What are the functions of cloud notes, and how do browsers add cloud note plug-ins

Adruino 基础实验学习(一)
![[cloud native] 4.1 Devops foundation and Practice](/img/09/5423540d0a4a11bc7162c5ab343a4d.png)
[cloud native] 4.1 Devops foundation and Practice

租户问题。

Acwing 379. hide and seek problem solution (minimum path non repeating point coverage)

Bitmap这个“内存刺客”你要小心~

2. Login - verification code function and saving login status

Business Intelligence BI full analysis, explore the essence and development trend of Bi

prometheus+blackbox-exporter+grafana 监控服务器端口及url地址
随机推荐
Wechat applet - get user location (longitude and latitude + city)
Information System Project Manager - Chapter 10 communication management and stakeholder management examination questions over the years
1. Mx6ul core module use serial -rs485 test (x)
Mandatory interview questions: 1. shallow copy and deep copy_ Deep copy
EAM系统能帮助企业做什么?
[early knowledge of activities] list of recent activities of livevideostack
增删改查业务的快速上手
必会面试题:1.浅拷贝和深拷贝_深拷贝
C unit test
Handling process of the problem that the virtual machine's intranet communication Ping fails
LeetCode302场周赛第三题--裁剪数字后查询第 K 小的数字
How to choose cloud note tool? What can I do with cloud notes?
scipy.sparse.vstack
Li Kou daily question - day 39 -67. Binary sum
数仓:银行业数仓的分层架构实践
Tenant issues.
ggplot2学习总结
The third question of leetcode 302 weekly Games -- query the number with the smallest k after cutting the number
18_请求文件
图解B+树的插入过程