1

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.

Naresh J
  • 2,087
  • 5
  • 26
  • 39
  • possible duplicate of [Spring 3.1 JSON date format](http://stackoverflow.com/questions/9038005/spring-3-1-json-date-format) – Yurii Shylov Aug 07 '13 at 08:21

2 Answers2

1

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

glebiuskv
  • 321
  • 4
  • 13
0

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
Shamim Ahmmed
  • 8,265
  • 6
  • 25
  • 36