Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Date parameter parsing
RCirne
<p>Hello all,</p>
<p> </p>
<p>I have a report that takes 2 Date Time typed parameters. In my development environment it works just fine, but on the test environment the parsing of the parameters is not working properly. The date 01/01/14 is being parsed to 01/01/0014 instead of the correct 01/01/2014.</p>
<p> </p>
<p>Any ideas about where is the parsing configured? I am using BIRT 3.7.1, Red Hat server.</p>
<p> </p>
<p>Thanks in advance.</p>
Find more posts tagged with
Comments
Clement Wong
<p>It's possible that in your development environment, the SimpleDateFormat for Java or the OS is mm/dd/yy, but in your test environment, it's mm/dd/yyyy. </p>
<p> </p>
<p>You might want to check the locale set in your test environment as compared to dev. (Please get output of "locale" from your OS.)</p>
RCirne
<p>Hello Clement,</p>
<p> </p>
<p>Thanks for your response. The output of locale for both servers is the same:</p>
<p> </p>
<div>LANG=en_US.UTF-8</div>
<div>LC_CTYPE="en_US.UTF-8"</div>
<div>LC_NUMERIC="en_US.UTF-8"</div>
<div>LC_TIME="en_US.UTF-8"</div>
<div>LC_COLLATE="en_US.UTF-8"</div>
<div>LC_MONETARY="en_US.UTF-8"</div>
<div>LC_MESSAGES="en_US.UTF-8"</div>
<div>LC_PAPER="en_US.UTF-8"</div>
<div>LC_NAME="en_US.UTF-8"</div>
<div>LC_ADDRESS="en_US.UTF-8"</div>
<div>LC_TELEPHONE="en_US.UTF-8"</div>
<div>LC_MEASUREMENT="en_US.UTF-8"</div>
<div>LC_IDENTIFICATION="en_US.UTF-8"</div>
<div>LC_ALL=</div>
<div> </div>
<div> </div>
<div>Would you, or someone else, know how to find the SimpleDateFormat for Java in RedHat servers?</div>
<div> </div>
<div>Thanks</div>
Clement Wong
<p>Can you run the attached simple report in both environments? It has four Dynamic Text controls that displays the report's Java locale, default and short date formats, and the report's locale setting (<em>Report > Property Editor - Report > Properties > Advanced > Locale</em>).</p>
<pre class="_prettyXprint">
//
// Example output:
// en_US -- English -- United States
//
importPackage( Packages.java.util );
var locale = new Locale.getDefault();
lang = locale.getDisplayLanguage();
country = locale.getDisplayCountry();
locale + ' -- '+ lang + ' -- ' + country;
</pre>
<pre class="_prettyXprint">
importPackage( Packages.java.text );
dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.getDefault());
today = new Date();
dateOut = dateFormatter.format(today);
dateOut;</pre>
<pre class="_prettyXprint">
importPackage( Packages.java.text );
dateFormatter = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault());
today = new Date();
dateOut = dateFormatter.format(today);
dateOut;</pre>
<pre class="_prettyXprint">
reportContext.getLocale();</pre>