I am working with dates and times in several data sets and am having issues with time zone conversion. All of the data sets are set to GMT but I need to move the time zones back to their respective location. I have tried several thing to move the times but have been unsuccessful. My first mistake may have been setting the system environment to GMT but upon taking this away the time zones did not convert. Any suggestions on how to get the time zones to convert would be great. I attempt the conversion in the last three lines of the code.
#Sys.setenv(TZ = "GMT")
library(openair)
library(lubridate)
filedir <- "C:/Users/dfmcg/Documents/Thesisfiles/timezones/Mountain"
myfiles <- c(list.files(path = filedir))
paste(filedir, myfiles, sep = '/')
npsfiles <- c(paste(filedir, myfiles,sep = '/'))
for (i in npsfiles[1]) {
timeozone <- import(i, date="DATE", date.format = "%m/%d/%Y %H", header=TRUE, na.strings="-999")
y <- c(timeozone$date, tz = "UTC")
yy<- format(y, tz = "MST7MDT", usetz=TRUE)
}
this is what the data looks like before and after the conversion:
DATE O3
09/15/1990 00:00:00 24
09/15/1990 01:00:00 28
09/15/1990 02:00:00 26
09/15/1990 03:00:00 25
09/15/1990 04:00:00 -999