as.sim_datetime {simtimer}R Documentation

Transformation from a datetime to a sim_datetime

Description

as.sim_datetime() transforms a regular datetime element (POSIXt) to a sim_datetime (integer representing the passed seconds since origin_date). The timezone (tz) will be ignored at the moment. Therefore tz of datetime and origin_date should be identical.

Usage

as.sim_datetime(datetime, origin_date)

Arguments

datetime

A datetime (POSIXt)

origin_date

A datetime (POSIXt)

Value

A sim_datetime

Examples

origin_date <- as.POSIXct("2016-01-01 00:00:00", tz = "UTC")
as.sim_datetime(as.POSIXct("2016-01-01 00:01:00", tz = "UTC"), origin_date)
# [1] 60
as.sim_datetime(as.POSIXct("2016-01-02 00:01:00", tz = "UTC"), origin_date)
# [1] 86460

[Package simtimer version 4.0.0 Index]