to.posixt: Convert to POSIXt

Description Usage Arguments Details Author(s)

Description

Convert an object of class Date to class POSIXct without getting bogged down in timezone calculation.

Usage

1
2
  DateToPOSIX(timestamps)
  YearMonToPOSIX(timestamps)

Arguments

timestamps

An object of class yearmon or Date to be converted to POSIXct.

Details

Calling as.POSIXct on another date/time object (e.g. Date) applies a timezone correction to the object. This can shift the time marker by a few hours, which can have the effect of shifting the day by one unit. If the day was the first or last in a month or year, then the month or year will be off by one as well.

Coercing the object to the character representation of a Date prevents this adjustment from being applied, and leaves the POSIXt return value with the intended day, month, and year.

Author(s)

Steven L. Scott steve.the.bayesian@gmail.com


michelletran/bsts documentation built on March 29, 2020, 12:58 a.m.