In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you UTC time, GMT time, local time, Unix timestamp what is useful, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
1.UTC time and GMT time
We can think of Greenwich time as time coordinated time (GMT=UTC). Both Greenwich time and UTC time are calculated in seconds.
2.UTC time and local time
UTC + time zone difference = local time
The time zone difference is positive in the east and negative in the west. Here, the time zone difference of East eighth District is recorded as + 0800.
UTC + (+ 0800) = local Beijing time (1)
So, UTC = local time (Beijing time)-0800 (2)
3.UTC and Unix timestamps
The UTC time you see on your computer is calculated in seconds from (0:00:00, January 1, 1970). The UTC time you see is the number of seconds from this time point in 1970 to the specific time. This number of seconds is the Unix timestamp.
How to get the current Unix timestamp (Unix timestamp) in different programming languages?
JavatimeJavaScriptMath.round (new Date () .getTime () / 1000)
The value returned by getTime () is in milliseconds Microsoft .NET / C#epoch = (DateTime.Now.ToUniversalTime (). Ticks-621355680000000) / 10000000MySQLSELECT unix_timestamp (now ()) PerltimePHPtime () PostgreSQLSELECT extract (epoch FROM now ()) Python first import time and then time.time () Ruby gets the Unix timestamp: Time.now or Time.new
Display Unix timestamp: Time.now.to_iSQL ServerSELECT DATEDIFF (s, '1970-01-01 00 Unix), GETUTCDATE () Unix / Linuxdate +% sVBScript / ASPDateDiff ("s", "01max 01max 1970 00:00:00", Now ()) other operating systems
(if Perl is installed on the system) command line status: perl-e "print time"
How to implement Unix timestamp (Unix timestamp) → normal time in different programming languages?
JavaString date = new java.text.SimpleDateFormat ("dd/MM/yyyy HH:mm:ss") .format (new java.util.Date (Unix timestamp * 1000)) JavaScript first var unixTimestamp = new Date (Unix timestamp * 1000) and then commonTime = unixTimestamp.toLocaleString () Linuxdate-d @ Unix timestampMySQLfrom_unixtime (Unix timestamp) Perl first my $time = Unix timestamp and then my ($sec, $min, $hour, $day, $month, $year) = (localtime ($time)) Unix timestamp) PostgreSQLSELECT TIMESTAMP WITH TIME ZONE 'epoch' + Unix timestamp) * INTERVAL' 1 second' Python first import time and then time.gmtime (Unix timestamp) RubyTime.at (Unix timestamp) SQL ServerDATEADD (s, Unix timestamp, '1970-01-01 00 purge 0000') VBScript / ASPDateAdd ("s", Unix timestamp, "01max 01max 00:00:00 1970") other operating systems
(if Perl is installed on the system) command line status: perl-e "print scalar (localtime (Unix timestamp))" above is all the content of this article "what is the use of UTC time, GMT time, local time, Unix timestamp", thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.