Register
It is currently Fri Oct 24, 2014 8:43 pm

converting timezones


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Tue Mar 03, 2009 9:49 am   

Joined: Mon Apr 24, 2006 2:39 pm
Posts: 30
Location: Villahermosa
Hi I would like to have a script that convert the time. Basically I want to use the date command and add the hours depending by the different timezone.

Something like:
Code:
$ myscript.sh  -tz CST -tt 10:00
$ 5:00


Basically this script will give me a local time upon the timezone and target time.

* tz = timezone
* tt = target time


Top
 Profile WWW ICQ YIM  
 PostPosted: Tue Mar 03, 2009 11:43 am   
Moderator
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 229
Location: London - UK
assuming you have a recentish version of date the following converts between timezones;

Code:
TZ="America/New_York" date --date='TZ="Europe/London" 2009-03-03 17:30'


That converts London time 2009-03-03 17:30 to EST
Check the date info page as date developers are these annoying types that do better docs in info pages than in man pages :(

DW


Top
 Profile  
 PostPosted: Tue Mar 03, 2009 2:28 pm   

Joined: Mon Apr 24, 2006 2:39 pm
Posts: 30
Location: Villahermosa
thanks worked flawlessly


Top
 Profile WWW ICQ YIM  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP