当前位置:网站首页>Conversion of JS time and timestamp
Conversion of JS time and timestamp
2022-07-22 08:50:00 【Shanghai city flower】
Time to timestamp
timeToTimestamp(time){
let timestamp = Date.parse(time)
return timestamp;
},
Time stamp to UTC Time
timestampToUtc(timestamp){
let date = new Date(timestamp);
var YY = date.getUTCFullYear() + '-';
var MM = (date.getUTCMonth() + 1 < 10 ? '0' + (date.getUTCMonth() + 1) : date.getUTCMonth() + 1) + '-';
var DD = (date.getUTCDate() < 10 ? '0' + (date.getUTCDate()) : date.getUTCDate());
var hh = (date.getUTCHours() < 10 ? '0' + date.getUTCHours() : date.getUTCHours()) + ':';
var mm = (date.getUTCMinutes() < 10 ? '0' + date.getUTCMinutes() : date.getUTCMinutes()) + ':';
var ss = (date.getUTCSeconds() < 10 ? '0' + date.getUTCSeconds() : date.getUTCSeconds());
return YY + MM + DD +"T"+hh + mm + ss+".000Z";
},
边栏推荐
- 阿里云技术专家郝晨栋:云上可观测能力——问题的发现与定位实践
- Self study golang [3.1 defining variables] use VaR keyword to define variables, use var() to define variables collectively, omit int keyword and VaR keyword, and use colon: to replace the definition
- 自学golang【3.3go语言的循环语句】for循环语法结构,省略初始条件,省略递增条件,省略结束条件的应用
- Vscode add custom comment
- Update the version number and static resources (the storage address of the embedded web page)
- js 对象深拷贝
- C语言刷题笔记之基础不牢地动山摇 <一>
- [C language] document operation "I"
- JS时间和时间戳的转换
- 软考中级【数据库系统工程师】第2章:程序语言基础知识,自学软考笔记,程序语言概述程序语言翻译基础低级语言和高级语言编译和解释的区别中缀、前缀与后缀表达式程序语言的数据成分1)常量和变量2)全局变量和局
猜你喜欢
软考中级【数据库系统工程师】第2章:程序语言基础知识,自学软考笔记,程序语言概述程序语言翻译基础低级语言和高级语言编译和解释的区别中缀、前缀与后缀表达式程序语言的数据成分1)常量和变量2)全局变量和局
软考中级【数据库系统工程师】第1章:计算机系统知识,自学软考笔记,备考2022年5月份软考,计算机硬件系统CPU组成指令寄存器组总线输入输出的程序控制方式计算机体系结构与存储系统加密技术流水线技术
Postman 配置全局变量 postman设置全局token
Science and technology create value | cloud expansion technology is listed in the real list · top 100 of China's scientific and technological innovation brands list
Quantitative transaction journal - fallback analysis - February 6, 2021
Ten year traders' heavy recommendation: simple and easy to operate breakthrough callback strategy
指针深度进阶《六》(二维数组相关知识)
【flex布局快速上手】快速理解flex布局用法,通过常见的四个布局案例解释【详细注释,一看就会】
The difference between RDB and AOF in the persistence mode of redis
8-bit complement booth one bit multiplier
随机推荐
8-bit complement booth one bit multiplier
Self study golang [3.7map exercise code]
不断提升认知,从而达到交易的最高级别——稳定盈利(终)
Verilog -- Serial four bit adder and leading four bit adder 74hc283
Self study golang [3.3go language loop statement] for loop syntax structure, omit initial conditions, omit incremental conditions, omit the application of end conditions
软考中级【数据库系统工程师】第1章:计算机系统知识,自学软考笔记,备考2022年5月份软考,计算机硬件系统CPU组成指令寄存器组总线输入输出的程序控制方式计算机体系结构与存储系统加密技术流水线技术
量化交易中如何判断趋势
One question per day (1)
js bind
Remove styles pasted in TinyMCE
李宏毅《机器学习》丨5. Tips for neural network design(神经网络设计技巧)
Verilog application - 24 second basketball counter
RPA是什么?推荐让电商运营10倍提效的自动化工具
mysql
Soft test intermediate [Database System Engineer] Chapter 2: basic knowledge of program language, self-study soft test notes, overview of program language, basic translation of program language, diffe
Pointer depth solution "II" (pointer points to itself)
vscode添加自定义注释
Quantitative transaction Diary - summary in January 2021
try catch finally 中包含return的几种情况,及返回结果
The difference and implementation of MyISAM and InnoDB in MySQL