Dear all, I have found the following (for me) incomprehensible behaviour of ISOdate (POSIXct):> ISOdate(1900,6,16)[1] "1900-06-15 14:00:00 Westeurop?ische Sommerzeit"> ISOdate(1950,6,16)[1] "1950-06-16 14:00:00 Westeurop?ische Sommerzeit" Note that in the first case I get the 15th of June back, not the 16th as I would have expected! This happened under R-1.7.1 on both windows and linux. I would greatly appreciate your comments, Heiko
ISOdate works, by default, in the GMT timezone. Try: ISOdate(1900,6,16,tz="") ISOdate(1950,6,16,tz="") If you don't need timezones and don't want to worry about them you can alternately use the chron library for your dates and times. --- Date: Wed, 19 Nov 2003 14:58:24 +0100 From: Heiko Schaefer <heiko.schaefer at swissrisk.com> To: <r-help at stat.math.ethz.ch> Subject: [R] ISOdate returns incorrect date? Dear all, I have found the following (for me) incomprehensible behaviour of ISOdate (POSIXct):> ISOdate(1900,6,16)[1] "1900-06-15 14:00:00 Westeuropäische Sommerzeit"> ISOdate(1950,6,16)[1] "1950-06-16 14:00:00 Westeuropäische Sommerzeit" Note that in the first case I get the 15th of June back, not the 16th as I would have expected! This happened under R-1.7.1 on both windows and linux. I would greatly appreciate your comments, Heiko ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Well, I live only a few seconds away from GMT and I also get> ISOdate(1900,6,16,tz="")[1] "1900-06-15 12:00:00 GMT Daylight Time" 15th, not 16th. Was 1900 a strange leap year? I certainly haven't tested thoroughly but note this:> ISOdate(1900,2,16,tz="")[1] "1900-02-16 12:00:00 GMT Standard Time" # 16th OK in February> ISOdate(1900,3,16,tz="")[1] "1900-03-15 12:00:00 GMT Standard Time" # wrong for March Using today's release of rw181beta (up to date or what?) on Win 98 (oh well).> -----Original Message----- > From: Gabor Grothendieck [mailto:ggrothendieck at myway.com] > Sent: 19 November 2003 16:06 > To: heiko.schaefer at swissrisk.com; r-help at stat.math.ethz.ch > Subject: RE: [R] ISOdate returns incorrect date? > > > Security Warning: > If you are not sure an attachment is safe to open please contact > Andy on x234. There are 0 attachments with this message. > ________________________________________________________________ > > > > ISOdate works, by default, in the GMT timezone. Try: > > ISOdate(1900,6,16,tz="") > ISOdate(1950,6,16,tz="") > > If you don't need timezones and don't want to worry about them > you can alternately use the chron library for your dates and > times. > > --- > Date: Wed, 19 Nov 2003 14:58:24 +0100 > From: Heiko Schaefer <heiko.schaefer at swissrisk.com> > To: <r-help at stat.math.ethz.ch> > Subject: [R] ISOdate returns incorrect date? > > > > > Dear all, > > I have found the following (for me) incomprehensible behaviour of > ISOdate (POSIXct): > > ISOdate(1900,6,16) > [1] "1900-06-15 14:00:00 Westeuropdische Sommerzeit" > > ISOdate(1950,6,16) > [1] "1950-06-16 14:00:00 Westeuropdische Sommerzeit" > > Note that in the first case I get the 15th of June back, not > the 16th as > I would have expected! > This happened under R-1.7.1 on both windows and linux. > > I would greatly appreciate your comments, > > Heiko > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >Simon Fear Senior Statistician Syne qua non Ltd Tel: +44 (0) 1379 644449 Fax: +44 (0) 1379 644445 email: Simon.Fear at synequanon.com web: http://www.synequanon.com Number of attachments included with this message: 0 This message (and any associated files) is confidential and\...{{dropped}}
One other point that supports your hypothesis is that Excel 2000 on Windows 2000 has a problem in 1900 too. Enter a date into a cell and then enter =60 and it gives the date as Feb 29, 1900 even though 1900 is not a leap year. Windows Excel uses 1900 as the origin for time but when Microsoft later created the Mac version of Excel they changed the origin to 1904 -- presumably they had realized their error by that time. Excel 2000 allows you to change the default origin from 1900 to 1904 which allows Windows Excel to properly read Mac spreadsheets. See the following for more info on this and how to set the origin in Excel: http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q180/1/62.asp&NoWebContent=1 --- Date: Wed, 19 Nov 2003 16:33:51 +0000 (GMT) From: Prof Brian Ripley <ripley at stats.ox.ac.uk> To: Heiko Schaefer <heiko.schaefer at swissrisk.com> Cc: <r-help at stat.math.ethz.ch> Subject: RE: [R] ISOdate returns incorrect date? Well, one clue is that date is before the modern era, and most OSes only go back to 1902. Some only go back to 1970! I suspect the OS does not know that 1900 was not a leap year. On Wed, 19 Nov 2003, Heiko Schaefer wrote:> > Does this really work for you? I still get: > > ISOdate(1900,6,16) > [1] "1900-06-15 14:00:00 Westeuropäische Sommerzeit" > > ISOdate(1900,6,16,tz="") > [1] "1900-06-15 12:00:00 Westeuropäische Sommerzeit" > > Obviously the time son influences the time, but it can > Not possibly account for the difference of a full day?! > > Still puzzled... > > Heiko-- 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 ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Based on the discussion so far, the 1950 issue is due to the timezone and Prof. Riley has established that the 1900 issue is a coding error in printing dates (but not in ISOdate, itself, or in the representation of POSIXct dates). I assume that the 1900 was found by just playing around but if your data actually does go that far back then note that neither of the above two issues will affect you if you use chron:> require(chron) > chron( paste(3,16,c(1900,1950),sep="/"), out.format="year-m-d")[1] 1900-Mar-16 1950-Mar-16 --- Date: Wed, 19 Nov 2003 17:27:19 +0100 From: Heiko Schaefer <heiko.schaefer at swissrisk.com> To: <r-help at stat.math.ethz.ch> Subject: RE: [R] ISOdate returns incorrect date? It starts on the 1st of March 1900 to go wrong .... I feel better now that somebody Else these the same effect ;-) -----Original Message----- From: Simon Fear [mailto:Simon.Fear at synequanon.com] Sent: Mittwoch, 19. November 2003 17:17 To: ggrothendieck at myway.com; heiko.schaefer at swissrisk.com; r-help at stat.math.ethz.ch Subject: RE: [R] ISOdate returns incorrect date? Well, I live only a few seconds away from GMT and I also get> ISOdate(1900,6,16,tz="")[1] "1900-06-15 12:00:00 GMT Daylight Time" 15th, not 16th. Was 1900 a strange leap year? I certainly haven't tested thoroughly but note this:> ISOdate(1900,2,16,tz="")[1] "1900-02-16 12:00:00 GMT Standard Time" # 16th OK in February> ISOdate(1900,3,16,tz="")[1] "1900-03-15 12:00:00 GMT Standard Time" # wrong for March Using today's release of rw181beta (up to date or what?) on Win 98 (oh well).> -----Original Message----- > From: Gabor Grothendieck [mailto:ggrothendieck at myway.com] > Sent: 19 November 2003 16:06 > To: heiko.schaefer at swissrisk.com; r-help at stat.math.ethz.ch > Subject: RE: [R] ISOdate returns incorrect date? > > > Security Warning: > If you are not sure an attachment is safe to open please contact > Andy on x234. There are 0 attachments with this message. > ________________________________________________________________ > > > > ISOdate works, by default, in the GMT timezone. Try: > > ISOdate(1900,6,16,tz="") > ISOdate(1950,6,16,tz="") > > If you don't need timezones and don't want to worry about them you can> alternately use the chron library for your dates and times. > > --- > Date: Wed, 19 Nov 2003 14:58:24 +0100 > From: Heiko Schaefer <heiko.schaefer at swissrisk.com> > To: <r-help at stat.math.ethz.ch> > Subject: [R] ISOdate returns incorrect date? > > > > > Dear all, > > I have found the following (for me) incomprehensible behaviour of > ISOdate (POSIXct): > > ISOdate(1900,6,16) > [1] "1900-06-15 14:00:00 Westeuropdische Sommerzeit" > > ISOdate(1950,6,16) > [1] "1950-06-16 14:00:00 Westeuropdische Sommerzeit" > > Note that in the first case I get the 15th of June back, not > the 16th as > I would have expected! > This happened under R-1.7.1 on both windows and linux. > > I would greatly appreciate your comments, > > Heiko > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >Simon Fear Senior Statistician Syne qua non Ltd Tel: +44 (0) 1379 644449 Fax: +44 (0) 1379 644445 email: Simon.Fear at synequanon.com web: http://www.synequanon.com Number of attachments included with this message: 0 This message (and any associated files) is confidential and\...{{dropped}}
I've been using the following little `helper` function: tea <- function() { shell("C:\\program files\\kettle\\tea.exe /2sugars", wait=FALSE) } I was thinking of submitting it to CRAN until I discovered that when I ran it on my laptop on holiday in Italy, it made coffee! I reluctantly decided not to submit it, given that relying on the OS, and particularly its timezone settings, obviously wasn't robust enough for a cross-platform implementation. Simon Fear Senior Statistician Syne qua non Ltd Tel: +44 (0) 1379 644449 Fax: +44 (0) 1379 644445 email: Simon.Fear at synequanon.com web: http://www.synequanon.com Number of attachments included with this message: 0 This message (and any associated files) is confidential and\...{{dropped}}