Not able to convert date from character to date format.
Is the system time zone different to the one in the database perhaps?
Thank you for the quick response.
I am new to rstudio could you please tell me how do we check this timezone difference.
But it should just take it from your system.
I checked it is europe/berlin
Can this be problem in the code? as the date returned is of previous date and previous year
Hi there @Anuja ,
It may be a problem depending on your use-case/purpose. I think the timezone thing in R has been around for a while and probably has some history too (happy for anyone to support/contest that statement). Lubridate may have a solution for you by forcing Timezone rules when dealing with dates.
Check out with_tz() and force_tz()
# with_tz(time, tzone = "") Date_to_Test <- ymd_hms("2020-01-01 00:00:01", tz = "Europe/Berlin") with_tz(Date_to_Test, "GMT") ## Heterogeneous time-zones: More_Test_Dates <- ymd_hms(c("2020-01-01 00:00:01", "2020-01-02 01:02:03")) force_tzs(More_Test_Dates, tzones = c("America/New_York", "Europe/Berlin")) force_tzs(More_Test_Dates, tzones = c("America/New_York", "Europe/Berlin"), tzone_out = "America/New_York") force_tzs(Date_to_Test , tzones = c("America/New_York", "Europe/Berlin"))
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.