| Here's the simple example to get GMT string. #include <time.h>
#include <sys/types.h>
#include <stdio.h>
int main()
{
struct tm *mytm;
time_t current_time = time((time_t*)NULL);
mytm = gmtime(¤t_time);
// convert GMT to string by asctime()
printf("%s", asctime(mytm));
return 0;
}
|