'Timezones when working with VEMCO VR2AR acoustic telemetry data
I'm wondering what the typical procedure for working with timezones for acoustic telemetry data is (part of a GLATOS array). If VR2AR receivers were initialized correctly to our PC clock and the time differences were correct to our actual timezone (in this case Eastern/US) and UTC is the default programming for the receivers, I assume our detections come out as UTC.
So, when I download and go to start analyzing, do I need to specify when using as.POSIX() in R that tz = Eastern/US? Does it matter? I tried changing my detection timestamps from UTC to US/Eastern and the timestamps didn't change.
Thanks for helping out a newbie! :)
Solution 1:[1]
Without the relevant lines of code, I can only guess you might be missing a step in converting the TZ, i.e., you may be assigning different TZs rather than converting between them.
If this is indeed the case, you can first use lubridate::force_tz
to define the current TZ. Then use lubridate::with_tz
to convert it to the desired TZ.
Here's an example, though I didn't quite understand what TZ within Eastern/US you're aiming for.
datetime as character:
dt = c("2019-06-25 14:15:47 UTC","2019-06-25 22:10:17 UTC", "2019-06-25 23:20:57 UTC", "2019-07-25 21:18:01 UTC", "2019-07-25 21:18:42 UTC", "2019-07-25 21:20:11 UTC")
define as POSIXct:
dt_pos = as.POSIXct(dt, format='%Y-%m-%d %H:%M:%S')
assign current TZ (UTC\GMT in this example):
dt_gmt = force_tz(dt_pos, tzone = "GMT")
convert to desired TZ (New York, US):
dt_NY = with_tz(dt_gmt, tzone = "America/New_York")
compare outputs:
dt_gmt
[1] "2019-06-25 14:15:47 GMT" "2019-06-25 22:10:17 GMT" "2019-06-25 23:20:57 GMT" "2019-07-25 21:18:01 GMT" "2019-07-25 21:18:42 GMT" "2019-07-25 21:20:11 GMT"
dt_NY
1] "2019-06-25 10:15:47 EDT" "2019-06-25 18:10:17 EDT" "2019-06-25 19:20:57 EDT" "2019-07-25 17:18:01 EDT" "2019-07-25 17:18:42 EDT" "2019-07-25 17:20:11 EDT"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | RPick |