Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个来自 Spring3 的休息方法,它返回预期的 JSON 响应,但时间戳中的日期除外。
在数据库中,日期存储为2013-08-08 00:30:00. 在向应用程序发送响应之前,我收到的日期为2013-08-08 00:30:00. 我已经在调试模式下检查过了。但是在完全执行休息服务后,我得到了长格式的日期为1375902000000.
2013-08-08 00:30:00
1375902000000
我想返回相同的时间戳格式而不是长格式。
我不想在客户端将长时间戳转换为再次日期格式。
默认情况下,它是序列化的,就long好像你想发送它一样2013-08-08 00:30:00,你可以尝试asString()
long
asString()
您可以执行以下操作来保持您想要的日期格式: