aslt: Convertion to POSIXlt

View source: R/aslt.R

asltR Documentation

Convertion to POSIXlt

Description

The argument is converted into POSIXlt with tz="GMT".

Usage

aslt(object, ...)

## S3 method for class 'character'
aslt(object, tz = "GMT", ...)

## S3 method for class 'POSIXct'
aslt(object, tz = NA, ...)

## S3 method for class 'POSIXlt'
aslt(object, tz = NA, ...)

## S3 method for class 'numeric'
aslt(object, ...)

Arguments

object

The character, POSIXct, POSIClt, or numeric which is converted to POSIXct.

...

Arguments to be passed to methods.

tz

Timezone. If set, then the time zone will be changed of the object.

Value

An object of class POSIXlt

Methods

- aslt.character: Simply a wrapper for as.POSIXlt

- aslt.POSIXct: Converts to POSIXct.

- aslt.POSIXlt: Changes the time zone of the object if tz is given.

- aslt.numeric: Converts from UNIX time in seconds to POSIXlt.

Examples


# Create a POSIXlt with tz="GMT"
aslt("2019-01-01")
class(aslt("2019-01-01"))
aslt("2019-01-01 01:00:05")

# Convert between time zones
x <- aslt("2019-01-01", tz="CET")
aslt(x,tz="GMT")

# To seconds and back again
aslt(as.numeric(x, units="sec"))


onlineforecast documentation built on Oct. 12, 2023, 5:15 p.m.