How to get the first calendar time in C

1 Answer

0 votes
#include <stdio.h>
#include <time.h>

int main(void)
{
    struct tm first = { .tm_mday = 1 };

    mktime(&first);

    printf("%s", asctime(&first));

    return 0;
}




/*
run:

Sun Jan  1 00:00:00 1900

*/

 



answered Nov 8, 2022 by avibootz

Related questions

1 answer 200 views
1 answer 172 views
1 answer 210 views
1 answer 191 views
1 answer 199 views
...