Hi Raymond,

I was actually looking for some support similar to what this brings -
https://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormatterBuilder.html#append-org.joda.time.format.DateTimePrinter-org.joda.time.format.DateTimeParser:A-.
:)

This PR might give you more context on this -
https://github.com/apache/hudi/pull/1648.

If such a support is not there with java.time, we might have to write
multiple try catch blocks to handle multiple input formats which might
affect performance, though I am not sure if it actually will. Otherwise I
am fine with all the points you mentioned. :)

On Mon, Sep 14, 2020 at 8:54 PM Raymond Xu <[email protected]>
wrote:

> Yes it does via this API. And I believe the APIs are flexible enough to
> handle the use cases.
>
> https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#parse-java.lang.CharSequence-
>
> Also quote from the "About" section in https://www.joda.org/joda-time/
>
> > Joda-Time is the *de facto* standard date and time library for Java prior
> to Java SE 8. Users are now asked to migrate to java.time (JSR-310).
>
> Another motive to do 5) :)
>
> On Sat, Sep 12, 2020 at 11:20 PM Pratyaksh Sharma <[email protected]>
> wrote:
>
> > Hi Raymond,
> >
> > I have a question here. Does java.time.format.DateTimeFormatter support
> > parsing multiple input date formats like joda DateTimeFormatter does?
> > Support for multiple input date formats was the reason we migrated from
> > SimpleDateFormat to joda formatter. Please let us know.
> >
> > On Sun, Sep 13, 2020 at 4:01 AM Raymond Xu <[email protected]>
> > wrote:
> >
> > > Hi all,
> > >
> > > As there are many different ways of manipulating date time, some of
> which
> > > are inferior due to lack of thread-safety, I would like to propose
> > > standardizing date time APIs in Hudi's codebase.
> > >
> > > 1. Use java.time APIs as first class
> > > 2. Use java.time.Instant as first class for instantiation (e.g., avoid
> > new
> > > Date())
> > > 3. Prefer LocalDateTime over Calendar APIs
> > > 4. Prefer java.time.format.DateTimeFormatter over
> > > java.text.SimpleDateFormat
> > > 5. Migrate joda time APIs to java.time and remove the dependency
> > >
> > > This is far from an exhaustive list but can be useful for initial
> > > alignment. Any feedback? If agree on the preference, shall it be added
> to
> > > the code guidelines?
> > >
> > > Thanks.
> > >
> > > Best,
> > > Raymond
> > >
> >
>

Reply via email to