Red Hat Bugzilla – Bug 822521
date -d doesnt like hkt timezone
Last modified: 2012-05-18 03:57:01 EDT
Description of problem:
date doesnt seem to like the HKT timezone
the following commands will not work
#echo HKT: `date -d "2012-05-18 21:00:00 HKT"`
#echo `TZ=America/New_York date -d "$(TZ=:Asia/Hong_Kong date -d 9pm)" `
however this command does
#echo "HKG: `TZ=':Asia/Hong_Kong' date`"
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.user the above 3 commands
date: invalid date `2012-05-18 21:00:00 HKT'
Parsing these abbreviated timezones is inconsistent and ambiguous.
I wrote some notes on this here: http://www.pixelbeat.org/docs/linux_timezones/
Please only use the location based Asia/Hong_Kong as input
pls. see the second command used. it uses the full location as a timezone and yet the issue is still occurring
The second command in comment 1 is really 2 commands,
the first of which will generate an abbreviated output as
input to the second.
You can do what (I think) you want in a single date invocation,
using this form that was shown at link in comment 2:
TZ="America/New_York" date -d 'TZ="Asia/Hong_Kong" 9pm'
That shows the local time in New York corresponding to 9PM in Hong Kong