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)
Changing date format
Sachin0025
On Report Rendering event i want to display like str0='2010 jan 01' from the string str1='2010-01-01', but sorting should based on str1, but report should display the string str0.
Thanks in advance.
Find more posts tagged with
Comments
mcremer
<blockquote class='ipsBlockquote' data-author="'Sachin0025'" data-cid="80833" data-time="1312183420" data-date="01 August 2011 - 12:23 AM"><p>
On Report Rendering event i want to display like str0='2010 jan 01' from the string str1='2010-01-01', but sorting should based on str1, but report should display the string str0.<br />
Thanks in advance.<br /></p></blockquote>
<br />
Hi Sachin0025,<br />
<br />
What you can do is set sortin on the string. And make a new Databinding that formats it to a date value.
Sachin0025
Thanks for reply,
but in some cases my string is coming as 2011-10 (means oct-2011) ,
so how can i convert it to oct-2011
mcremer
<blockquote class='ipsBlockquote' data-author="'Sachin0025'" data-cid="80837" data-time="1312187320" data-date="01 August 2011 - 01:28 AM"><p>
Thanks for reply,<br />
but in some cases my string is coming as 2011-10 (means oct-2011) ,<br />
so how can i convert it to oct-2011<br /></p></blockquote>
<br />
Birt comes with the Mozilla Rino engine. This mean you can use Java for example:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
-- Java has a bad neck to have standart American standarts.
nl_NL = new Packages.java.util.Locale("nl","NL");
dfd = new Packages.java.text.SimpleDateFormat("MM-yyyy",nl_NL);
pd = dfd.parse(params["stringdate"].value)
pd;
</pre>
<br />
Now you can use the date formating of Birt natfily but if you want to keep a string you could also do this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
-- Java has a bad neck to have standart American standarts.
nl_NL = new Packages.java.util.Locale("nl","NL");
dfd = new Packages.java.text.SimpleDateFormat("MM-yyyy",nl_NL);
dfd2 = new Packages.java.text.SimpleDateFormat("MMM-yyyy",nl_NL);
pd = dfd.parse(params["stringdate"].value)
dfd2.format(pd);;
</pre>
<br />
The later process will be slowing down the general prepossesing but on render it will be less a hassel all in all there is no real profit in speed in using eather method.
Sachin0025
Hey thanks for the reply,
I have implemented it by writing script for beforedrawaxislabels
and its working fine now.