[R] strftime vs strptime ??

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Oct 29 16:44:01 CEST 2010


strptime() takes a character vector and makes a date-time object. 
That is input.

strftime() takes a date-time object and makes an character vector.
That is output, and it is normally called via format() or print().

Let's see what the help says (slightly edited to refer just to these 
two):

Date-time Conversion Functions to and from Character

(One is 'to' and one is 'from.)

      Functions to convert between character representations and objects
      of classes ‘"POSIXlt"’ and ‘"POSIXct"’ representing calendar dates
      and times.

      ‘strftime’ converts objects from the class ‘"POSIXlt"’ to
       character vectors.

      ‘strptime’ converts character vectors to class ‘"POSIXlt"’



On Fri, 29 Oct 2010, skan wrote:

>
> Hello
>
> Could anyone explain me the difference between strftime vs strptime, please
> ?
>
> I've read the help but it's a little bit cionfusing for me.
>
>
> cheers
> -- 
> View this message in context: http://r.789695.n4.nabble.com/strftime-vs-strptime-tp3018865p3018865.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org 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