将Unix时间戳转换为日期,或从当前时间生成时间戳。
A Unix timestamp (also known as Epoch time or POSIX time) is a system for describing a point in time. It represents the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC (the Unix Epoch), not counting leap seconds. This simple number makes date/time calculations and storage straightforward.
Unix time is a single signed integer that increases by one every second. It's timezone-independent since it always represents UTC. Converting to local time requires applying the appropriate timezone offset. The current Unix timestamp can be easily obtained in any programming language.
32-bit systems store Unix time in a signed 32-bit integer, which will overflow on January 19, 2038. Most modern systems use 64-bit integers, which won't overflow for billions of years.
Timestamps are timezone-independent, take less storage, are easy to compare and calculate with, and avoid parsing ambiguities that can occur with date string formats.