--- Rie! <[EMAIL PROTECTED]> wrote:
> On 28/03/2008, Edwin Pratomo <[EMAIL PROTECTED]> wrote:
>
> > class Time
> > def self.pst
> > begin
> > old_tz = ENV['TZ']
> > ENV['TZ'] = "US/Pacific"
> > t = Time.now
>
> from this line, what if you're dissallowed to write Time.now? what if
> there is an existed time already, say : 1.week.ago . Do you have any
> ideas how to *get* that 1.week.ago.pst .... That's why I emphasized
> the output result should exist as a Time object instance instead of
> Time class method.
in that case you need to know the time difference for the timezone of interest,
as described by hal fulton (in his ruby way).
TZ env doesn't help since localtime() syscall is called only once (i.e. it is
cached). but I think you can use the TZ env to generate a mapping between
timzeone and time difference with UTC.
rgds,
Edwin.
________________________________________________________
Bergabunglah dengan orang-orang yang berwawasan, di di bidang Anda! Kunjungi
Yahoo! Answers saat ini juga di http://id.answers.yahoo.com/