1
votes

I have a one rest method from Spring3 which returns expected JSON response except date which is in timestamp.

In database date is stored as 2013-08-08 00:30:00. Before sending response to the application, the date I am getting as 2013-08-08 00:30:00. I have checked it in debug mode. But after complete execution of rest-service, I got the date in long format as 1375902000000.

I want to return same timestamp format instead of long format.

I don't want to convert long timestamp to again date format at client side.

2
possible duplicate of Spring 3.1 JSON date format - Yurii Shylov

2 Answers

1
votes

By default it is serialized as long if you want to send it like 2013-08-08 00:30:00 you may try asString()

0
votes

You could do the following to keep your desire date format:

  1. Declare the bean property as String.
  2. Format the date object according to your desire format, example yyyy-dd-MM hh:mm:ss