From: unbewusst.sein@... (=?ISO-8859-1?Q?Une_B=E9vue?=) Date: 2010-06-12T18:35:06+09:00 Subject: Re: DateTime about the zone Brian Candler wrote: > > You mean it's 093429 local time in France? yes, it was ))) in France it's UTC + 2 hours now. > > That means that 073429 is UTC. > > >> datetime = DateTime.parse('2010-06-12T07:34:29') > => # > > I don't know how to ask a DateTime to change to the local timezone, but > I can do it with Time: > > >> require 'time' > => true > >> time = Time.parse('2010-06-12T07:34:29Z') > => Sat Jun 12 07:34:29 UTC 2010 > >> time.to_s > => "Sat Jun 12 07:34:29 UTC 2010" > >> time.getlocal > => Sat Jun 12 08:34:29 +0100 2010 Thanks, fine, seems to be easier to do with Time than with DateTime (strange enough!) even i've corrected datetime with tzinfo, gave the correct hour with a false time zone, strange... here the datas : utc_datetime_str = '2010-06-12T07:34:29UTC' tz = TZInfo::Timezone.get('Europe/Paris') local = tz.utc_to_local(utc_datetime) # --> local = 2010-06-12T09:34:29+00:00 here the hour is correct BUT the time zone : local_zone = local.strftime(fmt='%z') # --> local_zone = local.strftime(fmt='%z') = +0000 I'll switch to Time ))) -- � La gloire n'est pas de ne jamais tomber, mais de se relever chaque fois que l'on tombe. � (Proverbe chinois)