Data Structure & Algorithm: Level-1 Problem #56. Unix Timestamp

The Unix Time stamp is a way to track time as a running total of seconds. This count starts at the Unix Epoch on January 1st, 1970 at UTC. Therefore, the unix time stamp is merely the number of seconds between a particular date and the Unix Epoch. It should also be pointed out that this point in time technically does not change no matter where you are located on the globe. This is very useful to computer systems for tracking and sorting dated information in dynamic and distributed applications both online and client side.

Given a Unix timestamp, convert it to the standard date time.

Sample Input:

1618809248

Sample Output:

2021-04-18 22:14:08


数据结构和算法:初级练习题 #56 – Unix时间戳


Unix时间戳是从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数,不考虑闰秒。因此,unix时间戳是特定日期和unix纪元之间的秒数。从技术上讲,在地球上任何位置,这个时间点都不会改变。这对于需要在动态和分布式应用程序中跟踪搜索和时间相关信息的计算机系统非常有用。

给定一个Unix时间戳,把它转换为公元纪年时间。

输入样例:

1618809248

输出样例:

2021-04-18 22:14:08


Python Solution

Unix Timestamp