Skip to content

Parse a date with given locale #30

Open
@genmeblog

Description

@genmeblog

I want to parse a date for given string "Jan 1 2010". Since my locale is PL, (dt/local-date "MMM d yyyy" "Jan 1 2010") doesn't work. What works is: (dt/local-date "MMM d yyyy" "sty 1 2010")

Is there any way to add locale for formatter?

This code works for me:

(dt/local-date (-> (java.time.format.DateTimeFormatterBuilder.)
                   (.appendPattern "MMM d yyyy")
                   (.toFormatter java.util.Locale/ENGLISH)) "Jan 1 2010")

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions