简体   繁体   English

Crystal Report + C#日期格式

[英]Crystal report + c# date format

I have datetime var that I show him in Crystal report 我有日期时间变量,我在Crystal报表中向他显示

I whant to see in short format (dd/mm/yyyy) - but I see him in Long (dd/mm/yyy hh:mm:ss) 我希望以短格式(dd / mm / yyyy)看到-但是我以长格式(dd / mm / yyy hh:mm:ss)看到他

what can i do ? 我能做什么 ?

You have to format the field in Crystal Reports editor. 您必须在Crystal Reports编辑器中格式化该字段。 Right-click the field in design mode, and choose "Format" or something like that. 在设计模式下右键单击该字段,然后选择“格式”或类似的内容。

我用这种方法格式化日期

ToText(Date ({Table.DATEField}),"MM/dd/yyyy")

You can also use the CStr function to format the date as needed if this is going to be in a formula field. 如果要在公式字段中使用日期,还可以使用CStr函数根据需要设置日期格式。 I believe the below would work, but didn't try it to be certain. 我相信下面的方法会起作用,但是并没有尝试确定。

Cstr({field}, "dd/MM/yyyy")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM