Learn R Programming

tableschema.r (version 1.1.2)

types.castDate: Cast date

Description

cast date without a time

Usage

types.castDate(format = "default", value)

Arguments

format

available options are "default", "any", and "<pattern>" where

default

An ISO8601 format string

  • date: This MUST be in ISO8601 format YYYY-MM-DD

  • datetime: a date-time. This MUST be in ISO 8601 format of YYYY-MM-DDThh:mm:ssZ in UTC time

  • time: a time without a date

any

Any parsable representation of the type. The implementing library can attempt to parse the datetime via a range of strategies, e.g. lubridate, parsedate,strptime, DateTimeClasses.

<pattern>

date/time values in this field can be parsed according to pattern. <pattern> MUST follow the syntax of strptime. (That is, values in the this field should be parseable by R using <pattern>).

value

date to cast

See Also

Examples

Run this code
types.castDate(format = "default", value =  as.Date("2019-1-1"))

types.castDate(format = "default", value = "2019-1-1")

types.castDate(format = "any", value = "2019-1-1")

types.castDate(format = "%d/%m/%y", value = "21/11/06")

types.castDate(format = "%d/%m/%y", value = as.Date("2019-1-1"))

Run the code above in your browser using DataLab