as_unix: as_unix

View source: R/as_unix.R

as_unixR Documentation

as_unix

Description

This function convert a Date into Unix format: an integer denoting the number of seconds from the origin date, usually "1970-01-01".

Usage

as_unix(x = NULL, milliseconds = FALSE, origin = "1970-01-01")

Arguments

x

character or Date, in the format "yyyy-mm-dd" or "dd-mm-yyyy". In alternative it is possible to specify the Date also with the time in the format "yyyy-mm-dd hh:mm:ss" or "dd-mm-yyyy hh:mm:ss"

milliseconds

logical, if TRUE the output will be converted in milliseconds, otherwise it will be in seconds.

origin

character denoting the origin date.

Value

integer character

Examples

as_unix("2023-01-01")
as_unix("01-01-2023")
as_unix("2023-01-01 10:23:23")
as_unix("01-01-2023 10:23:23")

beniamino98/cryptocompareR documentation built on June 19, 2024, 12:37 a.m.