#include #include #include #include int main () { struct tm tm, *tx; time_t start; char *buf1 = "2007-05-16 13:20:00 +0200"; char buf2[128]; memset (&tm, 0, sizeof (struct tm)); strptime (buf1, "%Y-%m-%d %H:%M:%S %z", &tm); start = mktime (&tm); tx = localtime(&start); strftime (buf2, sizeof buf2, "%Y-%m-%d %H:%M:%S %z", tx); printf ("%s\n", buf1); printf ("%s\n", buf2); } [root@orbit-14 /root]$ /mnt/lithium/jrydberg/p3 2007-05-16 13:20:00 +0200 2007-05-16 14:20:00 +0200