C# 如何删除时间并仅在 RDLC 中显示日期

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9140630/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 06:08:27  来源:igfitidea点击:

How to remove the time and Display the Date only in RDLC

c#winformsrdlc

提问by Sagotharan

all I am using Winform(C#) and RDLC MySQL. In that I try to show the date only in Tablex.

我正在使用 Winform(C#) 和 RDLC MySQL。我尝试仅在 Tablex 中显示日期。

But this date format have time also. How to remove the time.

但是这种日期格式也有时间。怎么去掉时间。

My Expression is,..

我的表达是,..

=Fields!date.Value

See my report below.

请看我下面的报告。

enter image description here

在此处输入图片说明

Thanks in advance?

提前致谢?

I am tried =Fields!date.Value.ToString("dd/MM/yyyy") in expression But It through error,.. Error 1 An error occurred while validating. HRESULT = '8000000A'

我在表达式中尝试 =Fields!date.Value.ToString("dd/MM/yyyy") 但它通过错误,.. 错误 1 ​​验证时发生错误。HRESULT = '8000000A'

采纳答案by nemesv

You can use the FormatDateTimemethod:

您可以使用FormatDateTime方法:

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

Or you can set the formatting in the properties window: enter image description here

或者您可以在属性窗口中设置格式: 在此处输入图片说明

回答by chirag

formate(Fields!date.Value,"dd/MM/yyyy")

格式(字段!日期。值,“dd/MM/yyyy”)

回答by Talha Imam

This worked for me:

这对我有用:

=FormatDateTime(Now(), DateFormat.ShortDate)

回答by Ajay Dagade

="Current Date:-"&Format(Now,"dd/MM/yyyy hh:mm tt") this is for current date and time

="当前日期:-"&Format(Now,"dd/MM/yyyy hh:mm tt") 这是当前日期和时间

回答by Riya Ashfaque Ahamad

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

The image shows the working of dateFormat.

图像显示了 dateFormat 的工作。

The image shows the working of dateFormat

图像显示了 dateFormat 的工作