I am using Joda DateTime function in scala to validate the year format as follows
def isValidDateType(value: String, Date_format: String): Unit = {
val fmt = DateTimeFormat forPattern Date_format
val output = fmt parseDateTime value
println(output)
}
isValidDateType("20156-06-06","yyyy-MM-dd")
Output : 20156-06-06T00:00:00.000+05:30
isValidDateType("201-06-06","yyyy-MM-dd")
Output: 0201-06-06T00:00:00.000+05:53:28
Is there any way to validate this year format ?