When I try to coerce a POSIXct
date-time to a Date
using as.Date
, it seems to return wrong date.
I suspect it has got something to
The clue is in the warning message. as.Date()
doesn't know how to interpret IST
as a timezone and so defaults to UTC
. Assuming that IST
is Indian Standard Time (rather than Irish Standard time) and that IST is UTC+5:30, as.Date()
is giving the expected result, even if it is incorrect for your purposes.
Providing a date with a timezone expressed as an offset from UTC gives the desired result.
as.Date("2020-03-24 00:02:00 UTC+5:30")
[1] "2020-03-24"