[R] Dates in Windows
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Jun 14 12:45:47 CEST 2007
%s is of course not documented on ?strftime: it is a glibc extension and
marked as such on my Linux man page.
But as.numeric(x) gives you the number of days, and
as.numeric(as.POSIXct(x)) gives you the number of seconds, equal to
86400*as.numeric(x).
[Why are you including empty commands at the end of every R line?
It is not necessary and makes the code harder to read.]
On Thu, 14 Jun 2007, Tom McCallum wrote:
> Hi everyone,
>
> When using R on Linux I can do the following:
>
>> x <- as.Date("01/04/2007", "%d/%m/%Y");
>> x
> [1] "2007-04-01"
>> print(format(x, "%s"));
> [1] "1175385600"
>
> When using R in Windows XP though the format "%s" does nothing but return
> a blank string. How can I convert a date to the number of seconds since
> 1970 in Windows?
>
> Cheers
>
> Tom
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
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
More information about the R-help
mailing list