Conversion timestamp (timeStamp) in Excel

image

=TEXT((A2/1000+8*3600)/86400+70*365+19,"yyyy-mm-dd hh:mm:ss.000")

=((B2-70*365-19)*86400-8*3600)*1000

 

What is a timestamp?
Unix timestamp (Unix timestamp), also known as Unix time (Unix time), POSIX time (POSIX time), is a time representation.

Until now defined as the total number of milliseconds from GMT January 1, 1970 00 hours 00 minutes 00 seconds (Beijing time on January 1, 1970 08 hours 00 minutes 00 seconds).

 

image

Excel, the date and time fields, in fact, is a sequence of values, it 1900-1-0 0, every passing day sequence value plus 1, and time is decimal.

 

(A2 / 1000 + 8 * 3600) / 86400 + 70 * 365 + 19 understood that the

 

A2 / 1000: conversion of milliseconds seconds Note: If timeStmap seconds, 1000 in addition to the would not.

8 * 3600: GMT 0 when the time zone to GMT +8 zone

86400: a second to days (= 24 * 60 * 60)

365 * 70: 70-year difference (timeStamp and Excel to calculate the starting point of difference: 1900 to 1970)

19: 1900 to 1970, a total of 17 leap year, taking into account as Excel will 1900-1-1 1, the formula should be added the final 18 instead of asking to add 19? This is a bug Excel in - 1900年也被当作闰年, and therefore should pay more then one day. Also note that, in Excel's Tools -> Options, there is the 1904 date system, if checked, the above formula should be changed to 70 66.

 

Online conversion tools: https://tool.lu/timestamp

Guess you like

Origin www.cnblogs.com/Tty725/p/11593334.html
Recommended