NiBE
NiBE

Reputation: 927

Grails export plugin set timezone

I'm exporting in an excel file a list of records which contains a date.

I'm using Export plugin 1.6 in Grail 2.3. This is the simple code I use:

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

The file is correctly created but all the date I have taken the GMT value instead the original one.

I think there is a setting in the parameter of the filed that I can pass but I have no idea what to write.

thanks

Upvotes: 0

Views: 160

Answers (1)

defectus
defectus

Reputation: 1987

You can try to use formatters to convert the date field into the correct target type (or at least format it as in the example below).

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)

Upvotes: 1

Related Questions