Skip to content

Date format

Ahmad K. Bawaneh edited this page Jun 25, 2020 · 3 revisions

Date format

if we have a @QueryParam or @PathParam or @HeaderParam and the type of parameter is Date then we can use @DateFormat annotation provided by domino-rest to specify the pattern to format the value of the parameter, if @DateFormat is not specified we fallback to the default String.valueOf.

    @GET
    @Path("someService/{starting-date}")
    String getByDate(@QueryParam("birth-date") @DateFormat("dd-MM-yyyy") Date birthDate, 
                     @PathParam("starting-date") @DateFormat("d-M-yy") Date startingDate);