Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can Tme Zone be changed for date command?

Status
Not open for further replies.

pjb

Programmer
May 1, 2001
148
US
Is there a way to retrieve the current time from the date command for a different time zone?
 
just set the TZ variable:
in csh:
setenv TZ gb
in [k]sh:
TZ=gb export TZ

then run 'date'
 
Thanks,

Do you happen to know what the vaues are for eastern and central?
 
For Eastern Standard Time do:
Code:
TZ=EST5 date
The syntax (simplified) for TZ is 3 letters followed by the number of hours past GMT.

Hope This Help
PH.
 
Thanks,

Looks like even one letter will work. This gives me eastern time also:

TZ=x5 date '+%r'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top