-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stri_datetime_parse()
default to today's midnight
#469
Comments
This is an intended behaviour. I now mention it explicitly in the manual. The assumption is that if you wish to get any other defaults (say, midnight in the current time zone), you can always do something like:
|
I knew how to set the time at midnight. I just wanted to know the reason why you had made that decision. I am experimenting with your package because I like your goal: code should work the same in every other platforms or generalized to other locale. But in this case, I do not know how it is useful. Can you enlighten me? |
Actually, now I see I have a bug there, as the 'base' time is not re-set on every parsing activity. Thanks > stri_datetime_parse(c('1970-01-01', '12'), c('yyyy-MM-dd', 'HH'))
[1] "1970-01-01 09:30:13 AEST" "1970-01-01 12:30:13 AEST" |
This is actually the default behaviour that we get from ICU. Manual on cal ---- A Calendar set on input to the date and time to be used for missing values in the date/time string being parsed, and set on output to the parsed date/time. When the calendar type is different from the internal calendar held by this DateFormat instance, the internal calendar will be cloned to a work calendar set to the same milliseconds and time zone as the cal parameter, field values will be parsed based on the work calendar, then the result (milliseconds and time zone) will be set in this calendar. And cal is by default initialised with the current time. On a side note, > strptime('2019', '%Y')
[1] "2019-12-08 AEDT"
> strptime('12', '%M')
[1] "2021-12-08 00:12:00 AEDT"
|
Actually, the calendar set on input to the date and time to be used for missing values in the date/time string being parsed could be made changeable by the user I'll introduce a new argument to Thanks |
stri_datetime_parse()
?stri_datetime_parse()
add base date/time argument
It seems that R's
I will soon make stringi's behaviour compatible with the above. Fix on the way. |
stri_datetime_parse()
add base date/time argumentstri_datetime_parse()
default to today's midnight
Hello, great package.
stri_datetime_parse('2022-01-01', 'yyyy MM dd')
works well,except that time part is set to current time, something like
10:46:40
is current time. is this intended? if so why?The text was updated successfully, but these errors were encountered: