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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -