-
Notifications
You must be signed in to change notification settings - Fork 42
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
Configure disabling the interpretation of dates #80
Comments
Implementation proposalSAS supports huge amount of date, time and date-time formats. In general it supports more than hundred formats (https://v8doc.sas.com/sashtml/lgref/z0309859.htm). I've implemented and unit-tested about 500+ variations. Implementation details
This implementation should not break existing clients of the Parso, because by default it still returns dates as Java Dates as it was before. Actually it is not yet fully support all possible SAS date formats. But approach itself is working and will remain the same as here: xantorohara/parso@master...xantorohara:feature/80-date-formats |
@xantorohara The Thank you for your efforts! |
…ime, Epoch seconds or SAS value
…ime, Epoch seconds or SAS value
* #80 support output of dates as Java Date, LocalDate or LocalDateTime, Epoch seconds or SAS value
So, for now parso represent dates as:
Regarding to produce dates using SAS formats - it turned out to be more work than it seemed. |
closed thanks to xantorohara |
Will this be available as 2.0.14 when it gets released? I checked earlier this week and all I saw was 2.0.13 on Maven Central. Once it's available, I will test it and let you know if I find anything. Thanks! |
You can try this out in the latest snapshot (2.0.14-SNAPSHOT), we usually aggregate more changes before we make a release. Would it be OK for you? |
I gave this a try tonight - I finally had some time! 😅 The good thing is switching to I had a couple blocks of code converting I did some performance testing to see if avoiding I look forward to using this in production. Thanks again to everyone who helped to make this possible! |
It would be nice if on the
SasFileReader
interface if you could disable date interpretation. For what I am working on, it would be beneficial to return the original number or ISO date/time string. Even aSystem.setProperty
would be a nice solution for backward compatibility.For one, Java's
Date
is pretty legacy. Even though the conversion to Java8 date types is pretty straight-forward, it opens up a lot of questions, like whether to useLocalDate
,LocalDateTime
,ZonedDateTime
, etc. that really are irrelevant to the SAS datasets I am processing.Maybe more importantly, I lose whether the original value was days since the epoch or seconds since the epoch and I don't want to have to write the inverse of your format-to-date logic, since there are so many formats. Other steps later on in the process already deal with converting the numeric values in SAS for comparison purposes, so I feel like I am wasting time undoing conversions or converting from
Date
to a different Java8 date class.The text was updated successfully, but these errors were encountered: