从表格单元格值中删除时间 [英] Remove time from a table cell value

查看:105
本文介绍了从表格单元格值中删除时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我有以下代码,表格单元格值与数据集值绑定。在这个单元格上是一个日期,但显示将跟随时间。我尝试了以下但似乎没有工作。以下是我的代码:



Hi i have the following codes which the table cell value is bind with a dataset value. On this cell is a date but the display would followed by time. I have tried the following but it seems like didnt work. Below are my codes:

this.xrTableCell26.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {new DevExpress.XtraReports.UI.XRBinding("Text", null, "GetAgingCustomizationDetailedInfos.DateSpecReceived", "{0:dd-MM-yyyy}")});
    this.xrTableCell26.Font = new System.Drawing.Font("Arial", 10F);
    this.xrTableCell26.Name = "xrTableCell26";
    this.xrTableCell26.StylePriority.UseFont = false;
    this.xrTableCell26.StylePriority.UseTextAlignment = false;
    this.xrTableCell26.Text = "xrTableCell26";
    this.xrTableCell26.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
    this.xrTableCell26.Weight = 0.9349493423361247D;

推荐答案

Hello friend,string.Format()是一个函数,可用于表示特定Date格式的DateTime对象。请尝试以下代码:



Hello friend, string.Format() is a function which can be used to represent a DateTime object in a specific Date format. Try the following code:

string currentDate = string.Format("{0:dd-MM-yyyy}", DateTime.Now);
Response.Write(currentDate); //16-06-2014



注意:如果传递字符串而不是DateTime对象,格式将不适用。

- DD


Note: If you pass a string instead of a DateTime object, the format will not be applicable.
- DD


.FormatString功能可以做到这一点4你...

ie

.FormatString ={0; d};

这只显示日期在表格中

问候..
.FormatString function can do this 4 u...
i.e
.FormatString = "{0;d}";
this will show only date in the table cells
Regards..


这篇关于从表格单元格值中删除时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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