You know, that is strange. The date command is amazingly flexible on what input it will accept but I can't get it to convert a simple unixtime to a string. Here are some examples: $ date --date yesterday Mon Dec 6 11:11:38 CST 2004 $ date --date "2 days ago" Sun Dec 5 11:11:38 CST 2004 $ date --date "2 days" Thu Dec 9 11:11:38 CST 2004 $ date --date "last year" Sun Dec 7 11:11:38 CST 2003 $ date --date "1102439535" date: invalid date `1102439535' Weird eh? Ok, but there is a solution: Here is how you print epoc: $ date -u --date "Jan 1, 1970 00:00:00" +%s 0 Now in our time zone: $ date -u --date "Jan 1, 1970 00:00:00 +0600" +%s -21600 So, $ date -u --date "Jan 1, 1970 00:00:00 +0600 + 1102439250 seconds" Tue Dec 7 11:07:30 UTC 2004 Ya, that seems crazy complicated but its the only way I could get it to work using strictly the bash command line. Using further formating options would clean up the output including correcting the timezone indicator. Hope that helps. -- John Lange OpenIT ltd. (204) 885 0872 On Tue, 2004-12-07 at 09:48, Kevin McGregor wrote:
Does anyone know of a quick way to convert the Unix time (in seconds since Jan 1, 1970) to a readable date via bash and standard commands?
_______________________________________________ Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable