Convert to date and time without time zone?

I have time formatted "1/1/2010 10:00"

. I would like to convert this to a time object. This time the company takes time in Calgary, Alberta. Please note that there is no daylight saving time adjustment during company time. How do I convert this to a date object?

+3


source to share


1 answer


You can use as.POSIXct

to create a date / time object. It looks like Calgary, Alberta is UTC-07: 00 as the time zones are coming, 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). Instead of specifying the real time zone, you can always use "GMT".

0


source







All Articles