Package 'utc'

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: 2025-01-23 04:39:34 UTC
Source: https://github.com/antojo-segura/utc

Help Index


add hours

Description

This function adds h hours to a POSIXct

Usage

h %h+% datetime

Arguments

h

number of hours

datetime

POSIXct

Value

POSIXct and h added


fromUTC

Description

Returns local time from UTC time

Usage

fromUTC(utctime, timeformat = "%Y-%m-%d %H:%M:%S")

Arguments

utctime

POSIXct UTC time

timeformat

string format of local time, by default it will be "%Y-%m-%d %H:%M:%S"

Value

localtime POSIXct local time

Examples

fromUTC( as.POSIXct("1991-06-29 05:27:25", tz = "UTC") )

hoursUTC

Description

This function returns time difference between UTC and Local

Usage

hoursUTC(to_test_time = Sys.time(), timeformat = "%Y-%m-%d %H:%M:%S")

Arguments

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"

Value

number of hours


toUTC

Description

Returns UTC time from local time

Usage

toUTC(localtime, timeformat = "%Y-%m-%d %H:%M:%S")

Arguments

localtime

POSIXct local time

timeformat

string format of local time, by default it will be "%Y-%m-%d %H:%M:%S"

Value

utctime POSIXct UTC time