C Example: Unix Timestamp: seconds to UTC date and time

🗓 Last updated: 2026-11-30👤 Written by: Gray✓ Reviewed by: Dana🏷 Category: Date & Time

Implements the inverse civil_from_days algorithm to turn serial days since 1970 back into a date, then splits the seconds within a day into hours, minutes and seconds. Converts timestamps 0, 1000000000, 1764000000, 2147483647 and 1700000000 into UTC, covering the epoch and the 2038 boundary.

🔥 Advanced Reference entries: kw-longfn-printfkw-int
🖥 Run OnlineGCC 10.2 · C11 standard · click ▶ to run · Copy code
🖨 Reference OutputMatches the online run in a standard C11 environment
C · GCC 10.2 · -std=c11
0 -> 1970-01-01 00:00:00 UTC
1000000000 -> 2001-09-09 01:46:40 UTC
1764000000 -> 2025-11-24 16:00:00 UTC
2147483647 -> 2038-01-19 03:14:07 UTC
1700000000 -> 2023-11-14 22:13:20 UTC
🧩 Keep Learning

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏