Your TZ variable may or may not be set correctly for NY ("America/New_York"
is acceptable).  Assuming it is, then try the xts on r-forge.

xts is in the process of supporting multiple time zones for different
objects, so some of the code is in flux (hence R-forge).

> Sys.setenv(TZ="Europe/Paris")

> t1
                        V3     V4     V5     V6 V7
1998-04-20 08:42:00 12.727 12.727 12.724 12.725  3
1998-04-20 08:43:00 12.727 12.727 12.724 12.725  3
1998-04-20 08:44:00 12.720 12.724 12.720 12.720  3
1998-04-20 08:45:00 12.713 12.724 12.712 12.721  4
1998-04-20 08:46:00 12.722 12.722 12.719 12.719  2
1998-04-20 08:47:00 12.719 12.719 12.717 12.717  2
Warning message:
timezone of object (America/New_York) is different than current timezone
(Europe/Paris).

> index(t1)
[1] "1998-04-20 08:42:00 EDT" "1998-04-20 08:43:00 EDT"
[3] "1998-04-20 08:44:00 EDT" "1998-04-20 08:45:00 EDT"
[5] "1998-04-20 08:46:00 EDT" "1998-04-20 08:47:00 EDT"

> format(index(t1),tz="Europe/Paris",usetz=TRUE)
[1] "1998-04-20 14:42:00 CEST" "1998-04-20 14:43:00 CEST"
[3] "1998-04-20 14:44:00 CEST" "1998-04-20 14:45:00 CEST"
[5] "1998-04-20 14:46:00 CEST" "1998-04-20 14:47:00 CEST"

You can also change the TZ of the object, though this process is being
cleaned up. It is currently stored in two places, as an attribute to the
index itself (new to recent releases of xts) and in the .indexTZ attribute.
 You'll need to change both for this to work nicely.  The former will be the
one and only place for this information in future releases.

> attr(attr(t1,"index"),"tzone") <- "Europe/Paris"
> attr(t1,".indexTZ") <- "Europe/Paris"

> t1
                        V3     V4     V5     V6 V7
1998-04-20 14:42:00 12.727 12.727 12.724 12.725  3
1998-04-20 14:43:00 12.727 12.727 12.724 12.725  3
1998-04-20 14:44:00 12.720 12.724 12.720 12.720  3
1998-04-20 14:45:00 12.713 12.724 12.712 12.721  4
1998-04-20 14:46:00 12.722 12.722 12.719 12.719  2
1998-04-20 14:47:00 12.719 12.719 12.717 12.717  2

HTH
Jeff


On Mon, Jul 26, 2010 at 3:28 AM, Anass Mouhsine <anass.mouhsine@gmail.com>wrote:

> Hi all,
>
> I've got an xts series in the New York time zone, and I would like to
> convert it to Paris time.
> > t1
>                      Open   High    Low  Close Volume
> 1998-04-20 08:42:00 12.727 12.727 12.724 12.725      3
> 1998-04-20 08:43:00 12.727 12.727 12.724 12.725      3
> 1998-04-20 08:44:00 12.720 12.724 12.720 12.720      3
> 1998-04-20 08:45:00 12.713 12.724 12.712 12.721      4
> 1998-04-20 08:46:00 12.722 12.722 12.719 12.719      2
> 1998-04-20 08:47:00 12.719 12.719 12.717 12.717      2
> Warning message:
> timezone of object (EDT) is different than current timezone (Europe/Paris).
>
> I tried to convert the index like this
>
> > format(index(t1),tz="Europe/Paris",usetz=TRUE)
> [1] "1998-04-20 10:42:00 CEST" "1998-04-20 10:43:00 CEST"
> [3] "1998-04-20 10:44:00 CEST" "1998-04-20 10:45:00 CEST"
> [5] "1998-04-20 10:46:00 CEST" "1998-04-20 10:47:00 CEST"
>
> but the result is erroneous.
>
> I tried this to confirm
>
> > txt<-"1998-04-20 08:42"
> >
> > txt.date<-as.POSIXct(txt,tz="America/New_York")
> > txt.date
> [1] "1998-04-20 08:42:00 EDT"
>
> > format(txt.date,tz="Europe/Paris",usetz=TRUE)
> [1] "1998-04-20 14:42:00 CEST"
>
> Which is the right answer.
>
> Am I doing something wrong? or missing something?
>
> Thx in advance
>
> Anass
>
> _______________________________________________
> R-SIG-Finance@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>



-- 
Jeffrey Ryan
jeffrey.ryan@insightalgo.com

ia: insight algorithmics
www.insightalgo.com

	[[alternative HTML version deleted]]

