I'm trying to format a date/time field as a date. I tried casting it as a date but ended up with the format 'April 21, 2009'. I need the format to be '4/21/2009'
Any suggestions?
Thanks!
Format the date using 'data format' option from properties, in that select the 'date' from left side drop down . in that date select 'data style' as 'short' and default 'date ordering' as 'day,month,year' hope this helps for ur problem
Alternatively you could rely on patterns. Appendix H in the Report Studio user guide (PDF format) lists the letter meanings.
Basically you select the item, then Data -> Data Format -> Choose Date, then find the pattern field and type in your pattern. Each letter in the appendix is a place holder for a date value.
So for example...
4/21/2009 would be...
d/MM/yyyy
(day, Month Month, Year Year Year Year)
Each letter in the pattern is 1 digit or character position that will be used. Note that capital vs. lower case matters as 'd' is day in month, vs. 'D' which is day in year.
To ensure that the day is 05 vs. 5, use 2 d's.
If u r using Oracle then u can go for to_char( <datetimeexpression> , 'DD/MM/YYYY') function.
-TS