-
Notifications
You must be signed in to change notification settings - Fork 60
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
DD/MM/YY 12:59:59 format #103
Comments
its nearly impossible to distinguish bw MM/DD/YY and DD/MM/YY .. automatic detection will also fail. As a workaournd: change 04/08/17 to 08/04/17 and use the supported format. |
Well, the other options are:
|
For the funs sake I've tried a quick test to find out how high odds are we could parse the date properly. require 'date'
ST = Date.strptime("04/01/2017", "%m/%d/%Y")
EN = Date.strptime("08/01/2017", "%m/%d/%Y")
def check(str, mask)
d = Date.strptime(str, mask) rescue nil
return false if d.nil?
return str != d.strftime("%y/%m/%d") && ST <= d && d<=EN
end
dates = (ST..EN).group_by do |i|
str = i.strftime("%y/%m/%d")
if check(str, "%y/%d/%m") || check(str, "%d/%m/%y") || check(str, "%m/%d/%y") then "ko" else "ok" end
end
ok = dates["ok"].count
ko = dates["ko"].count
p "probability of proper parsing is #{100.0*ok/(ok+ko)} (dates in range #{ST..EN})" The results are as follows:
That means: for recent sar files the odds are quite high we could identify proper date format. |
edited regexps of automatic detection. It can determine incorrect dates in case of 01/01/17 but at least it will not fail and determine correctly dates like 13/01/17 and 01/13/17 |
to increase accuracy, code can refer to current date, parsing 05/01/17, assuming, that the most probably sar has been captured recently =) |
Just in case:
I did try multiple variations like For instance:
jdk1.8.0_102:
"FULL" format cannot parse the date with the following exception:
That means there is no way to parse date header automatically. |
Add more patterns to automatic format detector, pick a format that produces maximum date fixes #103
Add more patterns to automatic format detector, pick a format that produces maximum date fixes #103
It would be nice to use the ISO format as default |
@delta160 what do you mean by "use as default" ? |
Well ksar 2-0.0.2. Which I do love!
Prompts for which of Two date formats to use, i would like to have the ISO format included and preferably as default
Håkan Winbom
Sent from mobile device
… On 19 Oct 2017, at 23:07, Pitt ***@***.***> wrote:
@delta160 what do you mean by "use as default" ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@delta160 well ISO format is supported since awhile. You can also stick to this format in the option dialog. ksar2-0.0.2 ?? could you point me to this version? Thx. |
… On Fri, Oct 20, 2017 at 10:09 AM, Pitt ***@***.***> wrote:
@delta160 <https://github.com/delta160> well ISO format is supported
since awhile. You can also stick to this format in the option dialog.
[image: image]
<https://user-images.githubusercontent.com/4181164/31811154-c20278dc-b57e-11e7-8fb8-c6dc458f5ac5.png>
ksar2-0.0.2 ?? could you point me to this version?
Thx.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#103 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AfaoWjnKbsZ6j_PDZG9jCDAmPiESI88Rks5suFU7gaJpZM4OtoLK>
.
--
Håkan Winbom
|
DD/MM/YY 12:59:59 format is not supported.
See below
This is 04-August-2017
The text was updated successfully, but these errors were encountered: