Convert a date field to a timestamp with or without time zone.
dbAsDate(conn, name, date = "date", tz = NULL, display = TRUE, exec = TRUE)
If exec = TRUE, returns TRUE if the conversion was successful.
exec = TRUE
TRUE
A connection object.
A character string specifying a PostgreSQL table name.
A character string specifying the date field.
A character string specifying the time zone, in "EST", "America/New_York", "EST5EDT", "-5".
"EST"
"America/New_York"
"EST5EDT"
"-5"
Logical. Whether to display the query (defaults to TRUE).
Logical. Whether to execute the query (defaults to TRUE).
Mathieu Basille mathieu@basille.org
The PostgreSQL documentation: http://www.postgresql.org/docs/current/static/datatype-datetime.html
## Example uses a dummy connection from DBI package conn <- DBI::ANSI() dbAsDate(conn, name = c("schema", "table"), date = "date", tz = "GMT", exec = FALSE)
Run the code above in your browser using DataLab