Grails——AS JSON后时间时区存在问题

2017-06-02  本文已影响0人  奇乞祈兴

在bootstrap中配置时间

class BootStrap {

     def init = { servletContext ->
         JSON.registerObjectMarshaller(Date) {
            //use any format as you want
            return it?.format("yyyy-MM-dd HH:mm:ss")
         }
     }
     def destroy = {
     }
}

原文连接:
https://stackoverflow.com/questions/39644593/value-of-date-object-in-a-map-is-changed-in-a-grails-controller-while-using-as

上一篇下一篇

猜你喜欢

热点阅读