I have a time in the format of "1/1/2010 10:00"
. I would like to convert this to a time object. This time is a company time based in Calgary, Alberta. Please note there is no daylight savings adjustment made in the company time. How would I convert this to a date-time object?
You can use as.POSIXct
to create the date/time object. Looks like Calgary, Alberta is UTC-07:00 as far as time zones go, so you can do
strptime("1/1/2010 10:00", format="%m/%d/%Y %H:%M", tz="Etc/GMT-7")
(assuming month/day/year format -- see ?strptime
for other format options). Rather than specifying the true time zone, you could always use "GMT" instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With