如何从Crystal报表的“公式"字段中删除“日期时间"值中的时间 [英] How to Remove Time in Datetime Value from Formula field of Crystal report

查看:75
本文介绍了如何从Crystal报表的“公式"字段中删除“日期时间"值中的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我正在使用c#在asp.net中进行报告.我使用一个字段来存储日期时间.

我在Crystal报表的命令"字段中使用选择查询".所以我从表中返回所有值.我提出一个公式来显示该时间.但它将整个记录显示为日期时间:


所以我写的是从该datetime值中删除时间.我只想显示日期而不是时间.

请帮帮我..

提前谢谢...
Mitesh

Hellooo,

i am making a report in asp.net with c# . there is a one field which i use to store datetime.

i use Select query in Command field of crystal report. so i return all the values from the table. i make one formula filed to display that time. but it display whole record as datetime:


so what i write to remove time from that datetime value. i want to display only date not time.

Please help me..

Thanks in advance...
Mitesh

推荐答案

使用datatime数据类型并从CR传递仅日期部分,或剥离打算在任何地方使用的时间部分.

Use datatime data type and pass just date part from CR or strip off the time part wherever you are planning to use it.

declare @d datetime<br />
<br />
set @d = getdate()<br />
<br />
select dateadd(day, datediff(day, 0, @d), 0)<br />
<br />
go


您可以尝试以下操作:
You can try something like:
String date = DateTime.Parse( "DB_DateTimeValue" ).ToString( "yyyy/MM/dd" );


这篇关于如何从Crystal报表的“公式"字段中删除“日期时间"值中的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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