The R Project SVN R

Rev

Rev 61153 | Rev 64321 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61153 Rev 61433
Line 42... Line 42...
42
}
42
}
43
\details{
43
\details{
44
  The \code{format} and \code{as.character} methods and \code{strftime}
44
  The \code{format} and \code{as.character} methods and \code{strftime}
45
  convert objects from the classes \code{"POSIXlt"} and \code{"POSIXct"}
45
  convert objects from the classes \code{"POSIXlt"} and \code{"POSIXct"}
46
  (not \code{strftime}) to character vectors.
46
  (not \code{strftime}) to character vectors.
47
  
47
 
48
  \code{strptime} converts character vectors to class \code{"POSIXlt"}:
48
  \code{strptime} converts character vectors to class \code{"POSIXlt"}:
49
  its input \code{x} is first converted by \code{\link{as.character}}.
49
  its input \code{x} is first converted by \code{\link{as.character}}.
50
  Each input string is processed as far as necessary for the format
50
  Each input string is processed as far as necessary for the format
51
  specified: any trailing characters are ignored.
51
  specified: any trailing characters are ignored.
52
 
52
 
Line 118... Line 118...
118
    \item{\code{\%Y}}{Year with century.  Note that whereas there was no
118
    \item{\code{\%Y}}{Year with century.  Note that whereas there was no
119
      zero in the original Gregorian calendar, ISO 8601:2004 defines it
119
      zero in the original Gregorian calendar, ISO 8601:2004 defines it
120
      to be valid (interpreted as 1BC): see
120
      to be valid (interpreted as 1BC): see
121
      \url{http://en.wikipedia.org/wiki/0_(year)}.  Note that the standard
121
      \url{http://en.wikipedia.org/wiki/0_(year)}.  Note that the standard
122
      also says that years before 1582 in its calendar should only be used
122
      also says that years before 1582 in its calendar should only be used
123
      with agreement of the parties involved.} 
123
      with agreement of the parties involved.}
124
    \item{\code{\%z}}{Signed offset in hours and minutes from UTC, so
124
    \item{\code{\%z}}{Signed offset in hours and minutes from UTC, so
125
      \code{-0800} is 8 hours behind UTC.}
125
      \code{-0800} is 8 hours behind UTC.}
126
    \item{\code{\%Z}}{(output only.) Time zone as a character
126
    \item{\code{\%Z}}{(output only.) Time zone as a character
127
      string (empty if not available).}
127
      string (empty if not available).}
128
  }
128
  }
129
  Where leading zeros are shown they will be used on output but are
129
  Where leading zeros are shown they will be used on output but are
130
  optional on input.
130
  optional on input.
131
  
131
 
132
  Note that when \code{\%z} or \code{\%Z} is used for output with an
132
  Note that when \code{\%z} or \code{\%Z} is used for output with an
133
  object with an assigned timezone an attempt is made to use the values
133
  object with an assigned timezone an attempt is made to use the values
134
  for that timezone --- but it is not guaranteed to succeed.
134
  for that timezone --- but it is not guaranteed to succeed.
135
  
135
 
136
  Also defined in the current standards but less widely implemented
136
  Also defined in the current standards but less widely implemented
137
  (e.g. not for output on Windows) are
137
  (e.g. not for output on Windows) are
138
  \describe{
138
  \describe{
139
    \item{\code{\%C}}{Century (00--99): the integer part of the year
139
    \item{\code{\%C}}{Century (00--99): the integer part of the year
140
      divided by 100.}
140
      divided by 100.}
Line 206... Line 206...
206
\note{
206
\note{
207
  The default formats follow the rules of the ISO 8601 international
207
  The default formats follow the rules of the ISO 8601 international
208
  standard which expresses a day as \code{"2001-02-28"} and a time as
208
  standard which expresses a day as \code{"2001-02-28"} and a time as
209
  \code{"14:01:02"} using leading zeroes as here.  The ISO form uses no
209
  \code{"14:01:02"} using leading zeroes as here.  The ISO form uses no
210
  space to separate dates and times.
210
  space to separate dates and times.
211
  
211
 
212
  For \code{strptime} the input string need not specify the date
212
  For \code{strptime} the input string need not specify the date
213
  completely: it is assumed that unspecified seconds, minutes or hours
213
  completely: it is assumed that unspecified seconds, minutes or hours
214
  are zero, and an unspecified year, month or day is the current one.
214
  are zero, and an unspecified year, month or day is the current one.
215
  
215
 
216
  If the timezone specified is invalid on your system, what happens is
216
  If the timezone specified is invalid on your system, what happens is
217
  system-specific but it will probably be ignored.
217
  system-specific but it will probably be ignored.
218
 
218
 
219
  OS facilities will probably not print years before 1 CE (aka 1 AD)
219
  OS facilities will probably not print years before 1 CE (aka 1 AD)
220
  correctly.
220
  correctly.
Line 236... Line 236...
236
  For links to versions available on-line see (at the time of writing)
236
  For links to versions available on-line see (at the time of writing)
237
  \url{http://dotat.at/tmp/ISO_8601-2004_E.pdf} abd
237
  \url{http://dotat.at/tmp/ISO_8601-2004_E.pdf} abd
238
  \url{http://www.qsl.net/g1smd/isopdf.htm}; for information on the
238
  \url{http://www.qsl.net/g1smd/isopdf.htm}; for information on the
239
  current official version, see
239
  current official version, see
240
  \url{http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html}.
240
  \url{http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html}.
241
  
241
 
242
  The POSIX 1003.1 standard, which is in some respects stricter than ISO 8601.
242
  The POSIX 1003.1 standard, which is in some respects stricter than ISO 8601.
243
}
243
}
244
\seealso{
244
\seealso{
245
  \link{DateTimeClasses} for details of the date-time classes;
245
  \link{DateTimeClasses} for details of the date-time classes;
246
  \link{locales} to query or set a locale.
246
  \link{locales} to query or set a locale.