Mike Ryan Mike Ryan - 2 months ago 13
C Question

linux convert time(for different timezones) to UTC

Is there a way, in linux, to problematically get UTC time for a given time string like

Tue Dec 14 10:30:23 PST 2012
Tue Jan 4 11:30:23 EST 2013

to a UTC time, irrespective of( and without changing) local time zone settings?


date -u -d "Tue Dec 14 10:30:23 PST 2012" reports Fri Dec 14 18:30:23 UTC 2012. The discrepancy is because Dec 14 2012 is in fact a Friday, not a Tuesday. It probably works better with valid input...