File: getDateTimeParts.R

package info (click to toggle)
gdata 3.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 964 kB
  • sloc: sh: 27; makefile: 15
file content (50 lines) | stat: -rw-r--r-- 1,382 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
getYear <- function(x, format, ...)
  UseMethod("getYear")

getYear.default <- function(x, format, ...)
  stop("'getYear' can only be used on objects of a date/time class")

getYear.Date <-
getYear.POSIXct <-
getYear.POSIXlt <- function(x, format="%Y", ...)
  format(x=x, format=format, ...)

getMonth <- function(x, format, ...)
  UseMethod("getMonth")

getMonth.default <- function(x, format, ...)
  stop("'getMonth' can only be used on objects of a date/time class")

getMonth.Date <-
getMonth.POSIXct <-
getMonth.POSIXlt <- function(x, format="%m", ...)
  format(x=x, format=format)

getDay <- function(x, format, ...)
  UseMethod("getDay")

getDay.default <- function(x, format, ...)
  stop("'getDay' can only be used on objects of a date/time class")

getDay.Date <-
getDay.POSIXct <-
getDay.POSIXlt <- function(x, format="%d", ...)
  format(x=x, format=format)

getHour <- function(x, format, ...)
  UseMethod("getHour")

getHour.default <- function(x, format, ...)
  stop("'getHour' can only be used on objects of a date/time class")

getMin <- function(x, format, ...)
  UseMethod("getMin")

getMin.default <- function(x, format, ...)
  stop("'getMin' can only be used on objects of a date/time class")

getSec <- function(x, format, ...)
  UseMethod("getSec")

getSec.default <- function(x, format, ...)
  stop("'getSec' can only be used on objects of a date/time class")