stri_datetime_fstr: Convert strptime-Style Format Strings

Description

This function converts strptime or strftime-style format strings to ICU format strings that may be used in stri_datetime_parse and stri_datetime_format functions.

Usage

stri_datetime_fstr(x, ignore_special = TRUE)

Arguments

x

character vector of date/time format strings

ignore_special

if FALSE, special identifiers like "datetime_full" or date_relative_short (see stri_datetime_format) are left as-is

Details

For more details on conversion specifiers please refer to the manual page of strptime. Most of the formatters of the form %x, where x is a letter, are supported. Moreover, each %% is replaced with %.

Warnings are given in the case of %x, %X, %u, %w, %g, %G, %c, %U, and %W as in such circumstances either ICU does not support the functionality requested using the string format API or there are some inconsistencies between base R and ICU.

Value

Returns a character vector.

Author(s)

Marek Gagolewski and other contributors

Examples

stri_datetime_fstr('%Y-%m-%d %H:%M:%S')
## [1] "yyyy'-'MM'-'dd' 'HH':'mm':'ss"