dbGetQuery returns character classes instead of Date or POSIXlt

1.3k views Asked by At

If I read out a field of type "datetime" it returns a character vector. Is it the genral way or do I have to notice something? This post came up with a similar question.

1

There are 1 answers

0
Richie Cotton On BEST ANSWER

In the DBI vignette (vignette("DBI")), Chapter 4 ("Data Type Mappings"), it states

By default dates and date-time objects are mapped to character using the appropriate TO_CHAR function in the DBMS (which should take care of any locale information).

I can't find any suggestion that RJDBC overrides this behaviour, so you'll have to manually convert your dates. Take a look at strptime, or the wrappers in the lubridate package.