On Wed, 6 Dec 2006, Derek Eder wrote:
> I have a time stamp in UTC (GMT) time:
>
> > format(ISOdatetime(1970,1,1,0,0,0)+1165398135729/1000,"%Y-%m-%d
> %H:%M:%OS3")
>
> "2006-12-06 09:42:18.823" (note millisecond accuracy, but not
relevant
> to question here)
But it is the wrong answer, and not what my system gives.
> Now, this time stamp actually "happened" at local (Swedish) time
one
> hour later (10:42).
So you need to tell R that it was in UTC, which is what the 'tz'
argument
is for:
> (z <- ISOdatetime(1970,1,1,0,0,0,
tz="UTC")+1165398135729/1000)
[1] "2006-12-06 09:42:15 UTC"> format(z, "%Y-%m-%d %H:%M:%OS3", tz="CET")
[1] "2006-12-06 10:42:15.729"
> Regarding summer/winter adjustments in time ("spring forward, fall
> back"): Is there a way of automatically recovering the local time
> adjustments for a given date? E.g., a date/time in springtime = GMT +2
> , else GMT +1
Is the above not enough? You can unpick it if you want to get the shift.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595