Package 'timeless'

Title: Fast General Purpose Date/Time Converter
Description: Fast general purpose date/time converter using 'Rust'. The package implements date time, date and epoch time parser for heterogeneous vectors of dates.
Authors: David Schoch [aut, cre] , Rollie Ma [ctb, cph] (author of dateparser : <https://github.com/waltzofpearls/dateparser>), Brandon W. Maister [ctb, cph] (author of chrono : <https://github.com/chronotope/chrono>), Dirkjan Ochtman [ctb, cph] (author of chrono : <https://github.com/chronotope/chrono>), Seonghoon Kang [ctb, cph] (author of chrono : <https://github.com/chronotope/chrono>), Eric Sheppard [ctb, cph] (author of chrono : <https://github.com/chronotope/chrono>), Paul Dicker [ctb, cph] (author of chrono : <https://github.com/chronotope/chrono>)
Maintainer: David Schoch <[email protected]>
License: MIT + file LICENSE
Version: 0.2.4.9000
Built: 2024-11-16 05:50:48 UTC
Source: https://github.com/schochastics/timeless

Help Index


A benchmark dataset with different date formats

Description

A benchmark dataset with different date formats

Usage

bench_date

Format

An object of class character of length 93.


Fast general purpose parser for date(time) from input data

Description

Fast general purpose parser for date(time) from input data

Usage

chronos(x, formats = NULL, tz = "", to_tz = "", out_format = "datetime")

Arguments

x

A vector with date(time) expressions to be parsed and converted.

formats

character vector of formats to try out (see base::strptime). If NULL, uses a set of predefined formats mostly taken from the anytime package.

tz

assumed input timezone. If "", uses local timezone. See details

to_tz

convert datetime to timezone given in to_tz. If "", tz is used. See details

out_format

character. Defining the format of the returned result. Can be "datetime", "date", or "character".

Details

The internal parsing is done "timezoneless". The timezone given in tz is just added to the datetime without any conversion. If to_tz is given, a conversion is made from tz to to_tz.

Value

A character vector which can be transformed to POSIXct or date

See Also

parse_datetime, parse_date, and parse_epoch if you need more control over formatting

Examples

chronos(bench_date)

Parse date from strings using different formats

Description

Parse date from strings using different formats

Usage

parse_date(x, formats = NULL, out_date = "%Y-%m-%d")

Arguments

x

A vector with date(time) expressions to be parsed and converted.

formats

character vector of formats to try out (see base::strptime). If NULL, uses a set of predefined formats mostly taken from the anytime package.

out_date

character defining the date format of the parsed strings

Value

character vector of parsed dates.


Parse datetime from strings using different formats

Description

Parse datetime from strings using different formats

Usage

parse_datetime(x, formats = NULL, out_datetime = "%Y-%m-%d %H:%M:%S")

Arguments

x

A vector with date(time) expressions to be parsed and converted.

formats

character vector of formats to try out (see base::strptime). If NULL, uses a set of predefined formats mostly taken from the anytime package.

out_datetime

character defining the datetime format of the parsed strings

Value

character vector of parsed datetimes


Parse datetime from epoch

Description

Parse datetime from epoch

Usage

parse_epoch(x, tz = "", out_datetime = "%Y-%m-%d %H:%M:%S")

Arguments

x

A vector with date(time) expressions to be parsed and converted.

tz

timezone of output datetime. If "", uses local timezone

out_datetime

character defining the datetime format of the parsed strings

Value

character vector of parsed dates.