Reputation: 43
I would like to check the given date and time against the following formats. Date -- {YYYYMMDD}, Time need to check with four formats -- {HHMM, or HHMMSS, or HHMMSSD, or HHMMSSDD} Above date and time formats needs to be checked using freemarker, How to check and validate in freemarker? .. Please suggest
Upvotes: 0
Views: 338
Reputation: 31162
Validation (like input validation) is normally not done in templates. So if you parse strings with ?date(pattern)
/?time(pattern)
, and the format doesn't match, the whole template terminates with error. If you just need to figure out which of those formats a string input is in, you could use the length (?length
) and/or regular expressions (?matches(regexp)
).
Upvotes: 0