From: "R.. Kumar 1.9.1 OSX" Date: 2010-08-21T03:05:34+09:00 Subject: Re: Dealing with dates & timezones Stuart Clarke wrote: > Hey all, > > I was wondering if I could ask for some advice regarding dates. I have a > file that contains lots of date values formatted like so: > > Sunday, 15 August 2010 05:46:50 o'clock BST > > I want basically out these dates as follows, applying the necessary time > zone bias: I have once done some time zone conversion in ruby. My apologies, I do not have the time to read your post carefully. I will just attach the small program here. It uses the tzinfo. (I cannot remember if that is inbuilt or is a gem). http://tzinfo.rubyforge.org/doc/files/README.html The full program is a bit long (attached) since i parse various command line parameters but here's the meat of it. It does various conversions in a loop. tz = TZInfo::Timezone.get(Choice.choices[:from]) tz1 = TZInfo::Timezone.get('Asia/Calcutta') #local = tz.utc_to_local(Time.utc(2008,9,4,14,00,0)) unparsed.each {|timestr| puts timestr local = tz.local_to_utc(Time.parse(timestr)) puts tz1.utc_to_local(local) } (you would not need to loop. unparsed refers to ARGV on command line) See for full: http://gist.github.com/540828 reg rahul -- Posted via http://www.ruby-forum.com/.