In R I am running the following query to retrieve data:
test <- dbGetQuery(conn = GetConnection("default"), statement = "SELECT PK_FK_RW_BOND_HOLDING_VAL_BOND, PK_CASHFLOW_DAT FROM RW_CASH_FLOWS_ON_BONDS WHERE PK_FK_RW_BOND_HOLDING_VAL_BOND = 'AT0000385745'
OR PK_FK_RW_BOND_HOLDING_VAL_BOND = 'RU000A0JV7J9'")
This returns
PK_FK_RW_BOND_HOLDING_VAL_BOND PK_CASHFLOW_DAT
RU000A0JV7J9 2018-01-14 23:00:00
RU000A0JV7J9 2017-01-14 23:00:00
RU000A0JV7J9 2019-08-01 00:00:00
RU000A0JV7J9 2019-01-31 23:00:00
RU000A0JV7J9 2018-08-01 00:00:00
RU000A0JV7J9 2018-01-31 23:00:00
AT0000385745 2017-08-01 00:00:00
AT0000385745 2017-01-31 23:00:00
where the PK_CASHFLOW_DAT
is of the class ("POSIXct" "POSIXt")
. On the other hand, if I run the exact same query in SQL (Toad for Oracle) it returns
PK_FK_RW_BOND_HOLDING_VAL_BOND PK_CASHFLOW_DAT
RU000A0JV7J9 1-8-2019
RU000A0JV7J9 1-2-2019
RU000A0JV7J9 1-8-2018
RU000A0JV7J9 1-2-2018
RU000A0JV7J9 1-8-2017
RU000A0JV7J9 1-2-2017
AT0000385745 15-1-2018
AT0000385745 15-1-2017
Now, the DateType of PK_CASHFLOW_DAT
is DATE
. The timezone of my computer as well as that of the server are UK.
My question is twofold:
1. Why is this happening in the first place.
2. I actually need the date to be in a character format. Is there some easy way in which we request the DateType Date
to be received as character
in R, instead of ("POSIXct" "POSIXt")
?
Thanks!