:: Forum >> Version 2 >>

date off by 1 day

Need help. When I set the cell format to a date in the grid, the date that is being displayed is one day off. Instead of display 02 May 2007, 01 May 2007 is being displayed. If I set the cell format to String then 2007-05-02 is displayed. This tells me that the date being returned by the database is correct. During the format for some reason it is losing a day.

My date formating is
date.setDataFormat("ISO8601");
date.setTextFormat("dd-mmm-yyyy");


Any ideas?

Stephen
Stephen
Thursday, June 7, 2007
That might be related to timezones. If the source date does not contain timezone it is assumed to be GMT, while output is converted to the local timezone. You can check this if you enable hours/minutes in the output.

To adjust source/target timezones you can use setDataTimezone and setTextTimezone methods -

http://www.activewidgets.com/aw.formats.date/setdatatimezone.html
http://www.activewidgets.com/aw.formats.date/settexttimezone.html


Alex (ActiveWidgets)
Thursday, June 7, 2007
Alex,

Thanks for your quick response, I believe my issue had to do with the fact that I of how I was populating the record inside of my JSP page.

What I originally had was:
<c:forEach var="row" items="${results}">
myData.push(["","${row.DOCID}","${row.ISSUE}"]);
</c:forEach>

I changed it to format it first then place it in the grid and all seems to be working.
<c:forEach var="row" items="${results}">
<fmt:formatDate var="ISSUE" value="${row.ISSUE}" pattern="MMM dd, yyyy" />
myData.push(["","${row.DOCID}","${ISSUE}"]);
</c:forEach>


Stephen
Thursday, June 7, 2007



This topic is archived.

Back to support forum

Forum search