sd5008 Posted September 18, 2008 Share Posted September 18, 2008 i have a Field in my report of type 'java.util.Timestamp'. I need to display the date in the respective timezone of the user.i am passing REPORT_TIME_ZONE as parameter from my controller as LoggedUser user = (User)request.getSession().getAttribute("loggeduser"); usertimezone = user.getTimezone();Map model=new HashMap();model.put("REPORT_TIME_ZONE",usertimezone); in my report that is the jrxml file i use <parameter name="DateFormatter" class="java.text.DateFormat" isForPrompting="false"> <defaultValueExpression>$P{REPORT_FORMAT_FACTORY}.createDateFormat("MMM dd, yyyy HH:mm", null, $P{REPORT_TIME_ZONE})</defaultValueExpression></parameter>and in my testfield expression i use <textFieldExpression>$P{DateFormatter}.format($F{WORK_PLAN_CREATED_TS})</textFieldExpression> my end result is that i am not able to convert the date into respective timezone. please do the needfull Link to comment Share on other sites More sharing options...
sd5008 Posted September 18, 2008 Author Share Posted September 18, 2008 when i try to print the REPORT_TIME_ZONE in the reportusing<textFieldExpression ><![CDATA[$P{REPORT_TIME_ZONE}.getDisplayName(true,TimeZone.SHORT)]]></textFieldExpression> i get to display the time zone as GMT though the timezone which i pass is IST from the spring controller why is this happenening can any one tell Link to comment Share on other sites More sharing options...
sd5008 Posted September 18, 2008 Author Share Posted September 18, 2008 sd5008Wrote: i have a Field in my report of type 'java.util.Timestamp'. I need to display the date in the respective timezone of the user.i am passing REPORT_TIME_ZONE as parameter from my controller as LoggedUser user = (User)request.getSession().getAttribute("loggeduser"); usertimezone = user.getTimezone();Map model=new HashMap();model.put("REPORT_TIME_ZONE",usertimezone); in my report that is the jrxml file i use <parameter name="DateFormatter" class="java.text.DateFormat" isForPrompting="false"> <defaultValueExpression>$P{REPORT_FORMAT_FACTORY}.createDateFormat("MMM dd, yyyy HH:mm", null, $P{REPORT_TIME_ZONE})</defaultValueExpression></parameter>and in my testfield expression i use <textFieldExpression>$P{DateFormatter}.format($F{WORK_PLAN_CREATED_TS})</textFieldExpression> my end result is that i am not able to convert the date into respective timezone. please do the needfull Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now