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
protected static final long MILLISECS_PER_DAY = 24 * 3600 * 1000;
	
	private static final long BASE_DATE_TIME;
	private static final String validStr = "#.0<>()%_";
	private static final String specialStr = "mMdDyYhHsSeEbBgGnN/*\"@";
	
	// for unicode currency symbols : "£¢€￥¥"
	private static final String currencySymbol = "\u00a3\u00a2\u20ac\uffe5\u00a5";
	protected static Logger logger = Logger.getLogger( ExcelUtil.class
			.getName( ) );
	private static final HashSet<Character> splitChar = new HashSet<Character>( );
	private static Pattern pattern = Pattern.compile( scicPattern,
			Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL );
	private static Map<String, String> formatCache = new HashMap<String, String>( );
	
	private static Map<String, String> namedPatterns = new HashMap<String, String>( );
	
	static
	{
		Calendar date = Calendar
				.getInstance( TimeZone.getTimeZone( "GMT-0:00" ) );
		date.setTime( new Date( "1900/01/01" ) );
		BASE_DATE_TIME = date.getTimeInMillis( );
		splitChar.add( Character.valueOf( ' ' ) );
		splitChar.add( Character.valueOf( '\r' ) );
		splitChar.add( Character.valueOf( '\n' ) );
		namedPatterns.put( "Fixed", "Fixed" );
		namedPatterns.put( "Percent", "Percent" );
		namedPatterns.put( "Scific", "Scific" );
		namedPatterns.put( "Standard", "Standard" );