java - How to get request parameter as hour with format AM/PM -
i have create rest endpoint accepts parameters hour format am/pm. thought use string pattern validation:
public responseentity<httpstatus> get( @requestparam @pattern("here regex match this: 9am") string hourfrom, @requestparam @pattern() string hourto)
do have better idea how resolve case?
@datetimeformat
annotation (with custom pattern value) before localtime
request parameter should trick.
public responseentity<httpstatus> get( @requestparam @datetimeformat(pattern = "ha") localtime from, @requestparam @datetimeformat(pattern = "ha") localtime to)
note: actual request parameter must use uppercase am/pm, example "6pm"
Comments
Post a Comment