Bug 320365 Excel emitter don't use reportContext timezone
- Create a blank report ; - Insert a "Data" Object of type "Date Time" without databinding. Write "new Date();" for the javascript expression ; - When invoking your report from the web viewer, configure a timezone with "__timezone" parameter. For instance, for me, "&__timezone=Europe/Paris" (GMT+2) ; - My JVM uses UTC ; - When using frameset servlet, in my browser, i have the right date. For instance 19/07/2010 18:19 (pattern is dd/MM/yyyy HH:mm). ; - When exporting to excel, I obtain a UTC date. For instance : 19/07/2010 16:19 (same pattern) ; - All others emitters are good. I get this issue only with excel. It seems that in jar org.eclipse.birt.report.engine.emitter.prototype.excel.xxx.jar, file org.eclipse.birt.report.engine.emitter.excel.ExcelUtil, method #formatDate, when formatting date as a String with a SimpleDateFormat, you don't use any timezone. Maybe the issue is here. public static String formatDate( Object data ) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH ); Date date = getDate( data ); if(date == null) { return null; } return dateFormat.format( date ); } An ugly solution is to set the default TimeZone in your initialize script : com.ibm.icu.util.TimeZone.setDefault(reportContext.getTimeZone());
engine/org.eclipse.birt.report.engine.emitter.prototype.excel/src/org/eclipse/birt/report/engine/emitter/excel/ExcelUtil.java
* limit of day component is January 1, 1900, which has serial value 1. The
	 * upper-limit is Dece 31, 9999, which has serial value 2,958,465. The
	 * time component of a serial value ranges in value from 0–0.99999999, and
	 * represents times from 0:00:00 (12:00:00 AM) to 23:59:59 (11:59:59 P.M.),
	 * respectively. Going forward in time, the time component of a serial value
	 * increases by 1/86,400 each second.
	 * 
	 * @param d
	 * @param zone
	 * @return
	 */
	public static String getDay( Date d, TimeZone zone )
	{
		Calendar currentDay = Calendar.getInstance( zone );
		currentDay.setTime( d );
		int hours = currentDay.get( Calendar.HOUR_OF_DAY );
		int minutes = currentDay.get( Calendar.MINUTE );
		int seconds = currentDay.get( Calendar.SECOND );
		double timeComponent = ( hours * SECONDS_PER_HOUR + minutes
				* SECONDS_PER_MINUTE + seconds )
				/ SECONDS_PER_DAY;
		if ( timeComponent < 0 || timeComponent > 1 )
		{
			logger.log( Level.WARNING, "Invalid time!" );
			timeComponent = 0;
		}
		long currentTimeInMillis = currentDay.getTimeInMillis( );
		int dayComponent = (int) ( ( currentTimeInMillis - BASE_DATE_TIME ) / MILLISECS_PER_DAY );
		if ( dayComponent < 0 || dayComponent > 2958463 )
		{