Convert a date field to a timestamp with or without time zone.
Arguments
- conn
A connection object.
- name
A character string specifying a PostgreSQL table name.
- date
A character string specifying the date field.
- tz
A character string specifying the time zone, in
"EST"
,"America/New_York"
,"EST5EDT"
,"-5"
.- display
Logical. Whether to display the query (defaults to
TRUE
).- exec
Logical. Whether to execute the query (defaults to
TRUE
).
See also
The PostgreSQL documentation: http://www.postgresql.org/docs/current/static/datatype-datetime.html
Author
Mathieu Basille mathieu@basille.org
Examples
## Example uses a dummy connection from DBI package
conn <- DBI::ANSI()
dbAsDate(conn, name = c("schema", "table"), date = "date", tz = "GMT",
exec = FALSE)
#> ℹ ALTER TABLE "schema"."table"
#> ALTER COLUMN "date" TYPE timestamptz
#> USING
#> "date"::timestamp AT TIME ZONE 'GMT';
#> ✖ Query not executed