time zone not changing when specified

↘锁芯ラ 提交于 2019-12-25 08:28:22

问题


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

来源:https://stackoverflow.com/questions/39021827/time-zone-not-changing-when-specified

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!