I have a date input box in my lift application, and I want to check that a user-entered date is in correct format: dd/mm/yyyy.
How can I write a reg
from this we can validate date in string as well as we get the expected date response by parsing in the format like "dd/MM/yyyy".
try { val format = DateTimeFormat.forPattern("dd/MM/yyyy")
format.parseMillis(dateInString)
val df = new SimpleDateFormat("dd/MM/yyyy")
val newDate = df.parse(dateInString)
true
} catch {
case e: ParseException => false
case e: IllegalArgumentException => false
}