Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can format date in report to appear exactly as I want - RDLC

I have a report in my application and this report will show a long date from db and I used this expression to make it shorter:

=FormatDateTime(Fields!StatementDate.Value,DateFormat.ShortDate)

and the date will show like this : 1/1/2010

I need to make it like this : 2010/1/1

How I can do it?

like image 348
Saleh Avatar asked Feb 17 '11 19:02

Saleh


3 Answers

That expression do the trick

=CDate(Fields!Fecha.Value).ToString("yyyy/M/d")
like image 98
pcofre Avatar answered Nov 20 '22 07:11

pcofre


I think that it is a lot cleaner to use the Format property rather than format it in your expressions: http://msdn.microsoft.com/en-us/library/ms252080%28v=vs.90%29.aspx

You can use the standard .NET formatting strings.

Value=Fields!StatementDate.Value
Format=yyyy/M/d

Fields!StatementDate.Value will need to be a DateTime, if not you can try convert it:

Value=CDate(Fields!StatementDate.Value)
like image 23
row1 Avatar answered Nov 20 '22 08:11

row1


=CDate(Fields!StatementDate.Value).ToShortDateString()
like image 22
Arushi Avatar answered Nov 20 '22 08:11

Arushi