Learn R Programming

timetools (version 1.5.2)

format: format a POSIX*t* object

Description

format a POSIX*t* (POSIXctp, POSIXcti, or POSIXst) object.

Usage

## S3 method for class 'POSIXctp':
format(x, ...)

## S3 method for class 'POSIXcti': format(x, format = '\%Y-\%m-\%d \%H:\%M:\%S', ...)

## S3 method for class 'POSIXst': format(x, format = NULL, ...)

Arguments

x
POSIX*t* object to format
format
Character string to precise the desired format.
...
other arguments to or from other methods

Value

  • character string

Details

For 'POSIXctp', the format method return a character : 'duration unit' (for instance : "1 year", "2 minutes", etc.).

'POSIXcti' are formatted by pasting the character strings representing both start and end of each intervals. Start and end's format can be specified with the format argument according to the basic format.POSIXct function.

'POSIXst' are formatted according to the format argument which must respect the following rules.

  • \%v value
  • \%s subtime unit (slotunit)
  • \%m main unit (slotof)
  • \%a Abbreviated weekday name in the current locale.
  • \%A Full weekday name in the current locale.
  • \%b Abbreviated month name in the current locale.
  • \%B Full month name in the current locale.
  • \%r timezone