| Title: | Coordinated Universal Time Transformations |
|---|---|
| Description: | Three functions are provided: first function changes time from local to UTC, other changes from UTC to local and third returns difference between local and UTC. %h+% operator is also provided it adds hours to a time. |
| Authors: | Antonio J. Segura |
| Maintainer: | Antonio J. Segura <[email protected]> |
| License: | GPL-2 |
| Version: | 0.1.5 |
| Built: | 2026-05-19 08:42:35 UTC |
| Source: | https://github.com/antojo-segura/utc |
This function adds h hours to a POSIXct
h %h+% datetimeh %h+% datetime
h |
number of hours |
datetime |
POSIXct |
POSIXct and h added
Returns local time from UTC time
fromUTC(utctime, timeformat = "%Y-%m-%d %H:%M:%S")fromUTC(utctime, timeformat = "%Y-%m-%d %H:%M:%S")
utctime |
POSIXct UTC time |
timeformat |
string format of local time, by default it will be "%Y-%m-%d %H:%M:%S" |
localtime POSIXct local time
fromUTC( as.POSIXct("1991-06-29 05:27:25", tz = "UTC") )fromUTC( as.POSIXct("1991-06-29 05:27:25", tz = "UTC") )
This function returns time difference between UTC and Local
hoursUTC(to_test_time = Sys.time(), timeformat = "%Y-%m-%d %H:%M:%S")hoursUTC(to_test_time = Sys.time(), timeformat = "%Y-%m-%d %H:%M:%S")
to_test_time |
only for testing UTC Sys.time() |
timeformat |
string format of local time, by default it will be "%Y-%m-%d %H:%M:%S" |
number of hours
Returns UTC time from local time
toUTC(localtime, timeformat = "%Y-%m-%d %H:%M:%S")toUTC(localtime, timeformat = "%Y-%m-%d %H:%M:%S")
localtime |
POSIXct local time |
timeformat |
string format of local time, by default it will be "%Y-%m-%d %H:%M:%S" |
utctime POSIXct UTC time