Grails导出插件设置时区

我在Excel文件中导出包含date的logging列表。

我在Grail 2.3中使用Export plugin 1.6。 这是我使用的简单代码:

exportService.export("excel", new FileOutputStream(new File(pathFile + "BSE.xls")), bseRecordList, [:], [:]) 

该文件是正确创build,但所有的date,我把格林尼治标准时间的价值,而不是原来的。

我认为我可以通过的字段参数中有一个设置,但我不知道要写什么。

谢谢

您可以尝试使用格式化程序将date字段转换为正确的目标types(或至less按照下面的示例格式化)。

 def dateFormatter = {_,value -> value?.format('dd-MM-yyyy hh:mm:ss:SSS')} def formatters = [dateField:dateFormatter] exportService.export("excel", new FileOutputStream(new File(pathFile + "BSE.xls")), bseRecordList, [:], [:], formatters)