Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

convert calendar time to epoch in c programming

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

int main(void)
{
    time_t     now;
    struct tm  ts;
    char       buf[80];

    // Get current time
    time(&now);

    // Format time, "ddd yyyy-mm-dd hh:mm:ss zzz"
    ts = *localtime(&now);
    strftime(buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", &ts);
    printf("%s
", buf);
    return 0;
}
Source by www.epochconverter.com #
 
PREVIOUS NEXT
Tagged: #convert #calendar #time #epoch #programming
ADD COMMENT
Topic
Name
6+1 =