.RDLC报告中的日期格式 [英] Date Format in .RDLC reports

查看:336
本文介绍了.RDLC报告中的日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在处理.rdlc报告。我在报告中有一个日期列。

我正在使用表达式格式化日期列

=格式(Fields!Date.Value,yyyy / MM / dd&&h:mm :ss tt)。

它在一个报告中工作正常。它正在正确显示日期时间示例:

Hi,

I am working on .rdlc reports.I have a date column in the report .
I am formating date column using the expression
=Format(Fields!Date.Value,"yyyy/MM/dd" & " " & "h:mm:ss tt").
It is working fine in one report.It is displaying the datetime correctly example:

2011/01/18 9:53:17 AM



但它在其他报告中不起作用。它在列中显示的值为yyyy / MM / dd h:mm:ss tt



提前致谢

.
But it is not working in other report.It is displaying the value in the column as yyyy/MM/dd h:mm:ss tt

Thanks in advance

推荐答案

字段可能有问题!Date.Value



尝试类似的东西:



Probably there is something wrong with Fields!Date.Value.

Try something similar:

DateTime dateValue;

if (DateTime.TryParse(Fields!Date.Value, out dateValue))
    return dateValue.ToString("yyyy/MM/dd h:mm:ss tt")
else
    return "n/a";





告诉我们!



干杯





编辑:



我刚试过以下代码:



Let us know!

Cheers




I just tried the following code:

string printableString;
DateTime dateValue;

if (DateTime.TryParse("22-08-2010 14:57:33", out dateValue))
    printableString = dateValue.ToString("yyyy/MM/dd h:mm:ss tt");
else
    printableString = "n/a";





结果是 2010-08-22 2:57:33 如预期的那样。



如果我尝试输入错误的输入 DateTime.TryParse(25-25-2010 14:57:33,out dateValue)

我得到不适用结果。



如果你给我看一些代码,也许我们可以找到一个合适的解决方案。



再见



And the result is 2010-08-22 2:57:33 as expected.

If I try to enter the wrong input as DateTime.TryParse("25-25-2010 14:57:33", out dateValue)
I get n/a as the result.

If you show me some more code, maybe we can find a proper solution.

Bye


这篇关于.RDLC报告中的日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆