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)
Need Date Format in Dynamic Text as dd/mm/yyyy
skumar16jan
Dear All,<br />
<br />
Can anyone tell why in Dynamic text(using below javascript) i am not getting date format as dd/mm/yyyy where in all places i have formatted the field as dd/mm/yyyy<br />
<br />
Even i tried both syntax:<br />
"Payment Date between " + row["CB_DATE_FROM"] + " to " + row["CB_DATE_TO"]<br />
"Payment Date between " + params["P_DATE_FROM"].value + " to " +params["P_DATE_TO"].value<br />
<br />
<br />
<strong class='bbc'>OUTPUT COMING:</strong><br />
Payment Date between<strong class='bbc'> 2010-01-01 to 2013-01-01</strong><br />
<br />
where<br />
<strong class='bbc'>REQUIRED OUTPUT:<br />
Payment Date between 01/01/2010 to 01/01/2013</strong><br />
<br />
<br />
Regards,<br />
Satinder kumar
Find more posts tagged with
Comments
Saggy123
Hi sKumar,
I was also suffered from this problem.but i was done this with script.
I provided some code snippet below that may help you.
importPackage(Packages.java.text);
importPackage(Packages.java.util);
df = new SimpleDateFormat("yyyy-MM-dd");
var fromDateParameter = df.parse(reportContext.getParameterValue("Date"));
df1 = new SimpleDateFormat("dd/MM/yyyy");
this.text = df1.format(fromDateParameter);
write this code in onCreate event of the dynamicText.
bricombs
Good Day
Also take a look at the following blog post on this subject.
http://birtworld.blogspot.com/2011/02/birt-formatting-numbers-and-dates.html
Tubal
You could also use the Birt Formatter:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>"Payment Date between " + Formatter.format(row["CB_DATE_FROM"],'dd/MM/YYYY') + " to " + Formatter.format(row["CB_DATE_TO"],'dd/MM/YYYY')
</pre>
android272
<p>When I add the bellow code to my app it tells me that 'dd/MM/YYYY' is an "Invalid character constant"</p>
<pre class="_prettyXprint _lang-">
Formatter.format(row["this.getValue()"],'dd/MM/YYYY')
</pre>
<p>also I am not working with the designer but in java at runtime.</p>