In FC4, it gives the result: Mon, 08 May 2006 17:10:11 +0000 In FC5, it fails. If's it's not _intended_ to work like that, please suggest an alternative way of converting seconds since 1970-01-01 UTC and a timezone into a localtime in that timezone. What we currently have is: sec=${date[0]}; tz=${date[1]} dtz=${tz/+/+ }; dtz=${dtz/-/- } pdate="$(date -Rud "1970-01-01 UTC + $sec sec $dtz" 2>/dev/null)"
Sorry, that wasn't complete. It's this... sec=${date[0]}; tz=${date[1]} dtz=${tz/+/+ }; dtz=${dtz/-/- } pdate="$(date -Rud "1970-01-01 UTC + $sec sec $dtz" 2>/dev/null)" echo ${pdate/+0000/$tz}
How about this?: date -Rd 'TZ="GMT+0100" 1970-01-01 UTC + 1147104611 sec' i.e. no -u option, and put TZ="..." at the start of the operand.
Even more baroque than the original... but works. Thanks :)
If you can depend on coreutils-5.3.0 or newer, then using the `-d@N_SECS' notation is nice: $ date -Rd @1147104611 Mon, 08 May 2006 18:10:11 +0200 $ date -Rd 'TZ="GMT+0100" 1970-01-01 UTC + 1147104611 sec' Mon, 08 May 2006 18:10:11 +0200