Ordinal dates in SSRS 2008
hi there,
I have created a report, here I need to show ordinal date. Could anyone plz tell me how to add ordinal date in SSRS 2008.
Eg: 1st , 2nd , 3rd etc
I want date in following format
Todays date : 16th
or
16th May 2010
May 16th, 2010 6:27am
hi there,
I have created a report, here I need to show ordinal date. Could anyone plz tell me how to add ordinal date in SSRS 2008.
Eg: 1st , 2nd , 3rd etc
I want date in following format
Todays date : 16th
or
16th May 2010
I am doing this way, is it correct?
=iif(Format(Now(),
"dd")= 01,Format(Now(),"dd")
& "st",
iif(Format(Now(),
"dd")= 02,Format(Now(),"dd")
& "nd",
iif(Format(Now(),
"dd")= 03,Format(Now(),"dd")
& "rd",
Format(Now(),
"dd") &
"th" )))
Free Windows Admin Tool Kit Click here and download it now
May 16th, 2010 6:59am
The technique you have described above should work just fine :)
Cheers,
Jason
P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
May 16th, 2010 7:30am
For reference, the function above doesn't cater for 11th, 12, 13th.
Here's what i did, it just produces the nth value from a given date. I used it as an expression in an SSRS report text box. I returned the month and year in separate fields, so they are not shown here.
=day(%yourdatevalue%) &
IIF(
(right(day(%yourdatevalue%),2)=11 or right(day(%yourdatevalue%),2)=12 or right(day(%yourdatevalue%),2)=13),"th",
IIF(right(day(%yourdatevalue%),1)=1,"st",
IIF(right(day(%yourdatevalue%),1)=2,"nd",
IIF(right(day(%yourdatevalue%),1)=3,"rd",
"th"))))
This produces 1st, 2nd,3rd, 4th, 11th, 12th, 13th, 14th,21st, 22nd etc.
Free Windows Admin Tool Kit Click here and download it now
July 26th, 2012 2:15am