-
Notifications
You must be signed in to change notification settings - Fork 612
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
Use Apache Commons FastDateFormat instead of SimpleDateFormat #41
Conversation
@sanelson2000 Could you consider the followings?:
|
Thanks for the suggestions. I'll look into it and update the PR when I get time. |
0f9eb9c
to
0784026
Compare
@xerial |
Looks good. Thanks for the contribution! |
Use Apache Commons FastDateFormat instead of SimpleDateFormat
No problem. Thanks for merging this! |
@xerial Is there somewhere where I can download the latest build? I'm seeing this when I try to load the driver that I compiled in my production environment on Windows... I'm guessing because I compiled it incorrectly... Seems to be a problem with the native DLL
|
Just released 3.8.10.2. Try this version. |
Awesome. That works. Thanks! |
SimpleDateFormat's .parse() method does not treat format Strings the same as its .format() method does. This is a problem when dealing with dates created by ActiveRecord, which stores dates as strings with pseudo-microsecond precision in the following format:
yyyy-MM-dd HH:mm:ss.SSS000
(It's actually stored with millisecond precision, but000
is always appended to the string.SimpleDateFormat will properly format a date given this format string, but it fails when trying to parse a date.
The FastDateFormat utility provided by Apache Commons Lang 3.x does not have this issue. As an added bonus, it is also faster and thread-safe.
This pull request uses FastDateFormat instead of SimpleDateFormat to get around this issue.
Unfortunately, it also has a few drawbacks.