开发者

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

开发者 https://www.devze.com 2023-02-11 12:46 出处:网络
I have a report in my application and this report 开发者_C百科will show a long date from db and I used this expression to make it shorter:

I have a report in my application and this report 开发者_C百科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?


That expression do the trick

=CDate(Fields!Fecha.Value).ToString("yyyy/M/d")


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)


=CDate(Fields!StatementDate.Value).ToShortDateString()
0

精彩评论

暂无评论...
验证码 换一张
取 消