Skip to contents

Generates SQL code for selecting different parts of the timestamp

Usage

hsSqlExTsFields(tsField, extraTsFields = 0:11)

Arguments

tsField

name of the table field containing the timestamp

extraTsFields

vector of integers representing different types of time-stamp information:
0 = the timestamp in POSIXct as it is converted to by R from the text representation delivered by MS Access,
1 = Timestamp as character string,
2 = Date,
3 = number of days since 1899-12-30,
4 = number of seconds since midnight of Date
5 = number of minutes since midnight of Date
6:8 = year, month, day
9:11 = hours, minutes, seconds

Value

Returns SQL code for selecting different types of information on the time stamp.

See also

Examples

hsSqlExTsFields("myTimestamp", c(6:11))
#> [1] "Year(myTimestamp) AS myTimestamp_year, Month(myTimestamp) AS myTimestamp_month, Day(myTimestamp) AS myTimestamp_day, Hour(myTimestamp) AS myTimestamp_h, Minute(myTimestamp) AS myTimestamp_m, Second(myTimestamp) AS myTimestamp_s"
  
## Output (re-formatted):
# "Year(myTimestamp) AS myTimestamp_year, 
#   Month(myTimestamp) AS myTimestamp_month, 
#   Day(myTimestamp) AS myTimestamp_day, 
#   Hour(myTimestamp) AS myTimestamp_h, 
#   Minute(myTimestamp) AS myTimestamp_m, 
#   Second(myTimestamp) AS myTimestamp_s"