Defined in header <time.h> | ||
---|---|---|
struct tm; |
Structure holding a calendar date and time broken down into its components.
int tm_sec | seconds after the minute – [0, 61](until C99) / [0, 60] (since C99)[note 1] |
int tm_min | minutes after the hour – [0, 59] |
int tm_hour | hours since midnight – [0, 23] |
int tm_mday | day of the month – [1, 31] |
int tm_mon | months since January – [0, 11] |
int tm_year | years since 1900 |
int tm_wday | days since Sunday – [0, 6] |
int tm_yday | days since January 1 – [0, 365] |
int tm_isdst | Daylight Saving Time flag. The value is positive if DST is in effect, zero if not and negative if no information is available |
Show the start of calendar time.
#include <stdio.h> #include <time.h> int main(void) { struct tm start = {.tm_mday=1}; mktime(&start); printf("%s\n", asctime(&start)); }
Possible output:
Mon Jan 1 00:00:00 1900
(C11) | converts time since epoch to calendar time expressed as local time (function) |
(C11) | converts time since epoch to calendar time expressed as Coordinated Universal Time (UTC) (function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/c/chrono/tm