UTC0

Date APIs by Language

Date/time API cheatsheet for C, Python, JavaScript, Java, Go, PHP, and SQL.

C standard library <time.h>

Use time() for Unix seconds, localtime() / gmtime() for struct tm , then strftime() to format.

time_t now = time(NULL);
struct tm *lt = localtime(&now);
char buf[64];
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", lt);
Specifier Meaning Example
%Y 4-digit year 2026
%m Month 01–12 05
%d Day 01–31 23
%H Hour (24h) 16
%M Minute 03
%S Second 00
%A Weekday (full) Saturday
%z UTC offset +0800

C++11+: use <chrono> and std::put_time with the same specifiers as strftime .