Parsing custom date formats in to a LocalDate

25 views
Skip to first unread message

Sean Farrow

unread,
Dec 20, 2020, 2:53:03 PM12/20/20
to noda...@googlegroups.com

Hi,

 

I have the following custom date format as part of a filename:

2020-12-20

That is the year (always as 4 digits), the month (as two digits) and the day (as two digits).

 

I have a few questions:

Is there a standard format that will parse this in to a local date>

 

If not, is there a way to change the date separator?

 

Thanks,

Sean.

Jon Skeet

unread,
Dec 20, 2020, 3:00:08 PM12/20/20
to Noda Time
That's just the ISO date format - use LocalDatePattern.Iso as a property. For formatting, you can specify a standard format string of "R" to format with ISO.

--

---
You received this message because you are subscribed to the Google Groups "Noda Time" group.
To unsubscribe from this group and stop receiving emails from it, send an email to noda-time+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/noda-time/DB7PR05MB56597C2CA40897F72BAB19EBC6C10%40DB7PR05MB5659.eurprd05.prod.outlook.com.

Sean Farrow

unread,
Dec 20, 2020, 3:14:08 PM12/20/20
to noda...@googlegroups.com
Hi,

Thanks much appreciated.

Sean

Sent from my iPhone

On 20 Dec 2020, at 20:00, Jon Skeet <sk...@pobox.com> wrote:


Reply all
Reply to author
Forward
0 new messages