jhickling Posted June 27, 2015 Share Posted June 27, 2015 Could someone please tell me how to correctly group by Month while allowing for multiple timezones in Jaspersoft?Our Mysql database is in UTC time, and I am in Australia, UTC +10:00, so a date that is '1st May 2015 08:00' for me is '30th April 2015 22:00' in the database. Using patterns in the designer converts UTC dates to my timezone correctly, but I cannot use one of these inbuild patterns in a group expression (at least not to my knowledge). How can I group by month while taking into account the timezone?Thanks,JustinUPDATE, I figured it out.Create a parameter (E.g. $P{DateFormatter}, not for prompting, class of DateFormat) in the report with the following default expression:$P{REPORT_FORMAT_FACTORY}.createDateFormat("dd/MM/yy", $P{REPORT_LOCALE},$P{REPORT_TIME_ZONE})[/code]This could be any date format, such as "MMMM, yyyy", etc etc.Then in the Group Expression its as simple as writing $P{DateFormatter}.format($F{TheDate}). This will then correctly group according to the local timezone, as opposed to the SQL database timezone. 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