|
Re: Formatting date in Dynamic text [message #652645 is a reply to message #652609] |
Fri, 04 February 2011 19:59 |
|
Nicola,
There a couple of ways you could do this. You could use a text element
instead of a data element and do something like:
<VALUE-OF>row["number"];</VALUE-OF><VALUE-OF format="MM/dd/YYYY"
row["date"]</VALUE-OF>
or
in your data item expression do something like:
importPackage( Packages.java.text );
var sdf = new SimpleDateFormat("MM/dd/YYYY", reportContext.getLocale());
var myformatteddate = sdf.format( row["date"]);
row["number"]+' of ' + myformatteddate.
Jason
On 2/4/2011 12:16 PM, nicola wrote:
> Hi,
> I have a dynamic text which should display:
>
> Exam n. 1234/2011 of 01/04/2010
>
> Inside the dynamic I have
>
> 'Exam n. ' + row["number"] + ' of ' + row["date"]
>
> but the result is:
>
> Exam n. 1234/2011 of Thu Apr 01 00:00:00 CEST 2010
>
>
> How can I format the date inside a dynamic text?
> Should I do it from sql side?
>
> Thank you
> Nicola
|
|
|
Re: Formatting date in Dynamic text [message #652939 is a reply to message #652609] |
Mon, 07 February 2011 17:04 |
|
I'd lean toward doing it on the SQL side.
If you have to do it in the BIRT side, you'll need to reference the Java SimpleDateFormat library (I think) and make calls using those methods. Someone else can probably point you to examples.
|
|
|
Powered by
FUDForum. Page generated in 0.02598 seconds