How to use asctime() to convert today calendar time to a textual representation in C

1 Answer

0 votes
#include <time.h>
#include <stdio.h>
 
int main(void)
{
    struct tm tm = *localtime(&(time_t){time(NULL)});
    printf("%s", asctime(&tm));
 
    return 0;
}

  
/*
run:
 
Wed Aug 24 10:45:24 2016

*/

 



answered Aug 24, 2016 by avibootz

Related questions

2 answers 99 views
99 views asked Jan 7, 2023 by avibootz
1 answer 187 views
1 answer 92 views
92 views asked Nov 8, 2022 by avibootz
1 answer 189 views
...