Alex Rivera | Logout

Regex date format validation on Java

Asked 2010-01-27T19:25:03.167
79

I'm just wondering if there is a way (maybe with regex) to validate that an input on a Java desktop app is exactly a string formatted as: "YYYY-MM-DD".

Edit
Report

1 Answer

2

Construct a SimpleDateFormat with the mask, and then call:

SimpleDateFormat.parse(String s, ParsePosition p)
answered 2010-01-27T19:29:46.463

Your Answer