[
https://issues.apache.org/jira/browse/ARROW-15813?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17514213#comment-17514213
]
Jonathan Keane commented on ARROW-15813:
----------------------------------------
Because we don't actually know the length of the first bit (or really any other
part, though ) of the string:
{code}
> times <- c("2012-05-25 18:45:32", "2020-5-6", "20-05-06", "2022-06-07 00:55",
> "2020-01-01 could be anything at all ROFL")
> strptime(times, format = "%Y-%m-%d")
[1] "2012-05-25 CDT" "2020-05-06 CDT" "0020-05-06 LMT" "2022-06-07 CDT"
[5] "2020-01-01 CST"
{code}
Or with {{%B}} it's even worse:
{code}
> months_plus <- c("2020 January 1 string", "2020 July 1 extra")
> strptime(months_plus, format = "%Y %B %d")
[1] "2020-01-01 CST" "2020-07-01 CDT"
{code}
> [R]strptime should support partial format
> -----------------------------------------
>
> Key: ARROW-15813
> URL: https://issues.apache.org/jira/browse/ARROW-15813
> Project: Apache Arrow
> Issue Type: Improvement
> Components: R
> Reporter: Dragoș Moldovan-Grünfeld
> Priority: Major
>
> In base R we can use {{strptime}} to parse and extract parts from a datetime
> by passing a restricted format.
> {code:r}
> > strptime("2012-05-25 18:45:32", format = "%Y-%m-%d")
> [1] "2012-05-25 BST"
> > strptime("2012-05-25 18:45:32", format = "%Y-%m-%d %H")
> [1] "2012-05-25 18:00:00 BST
> {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)