Datagrid中的日期格式 [英] Date Format in Datagrid

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

问题描述

我有以下代码:

I have a following code:

MtxtTrans_Date .Text  = TransGrid.CurrentRow.Cells["Trans_Date"].Value.ToString();


Trans_Date是日期格式字段.
如何使用这样的代码:


Trans_Date is a Date Format Field.
How use code like this:

MtxtTrans_Date .Text  = TransGrid.CurrentRow.Cells["Trans_Date"].Value.ToString("yyyy/MM/dd");



这段代码会产生错误.



This code generate error.

推荐答案

Hi body,
use this code to solve your problem
MtxtTrans_Date.Text=string.Format("{0:yyyy/MM/dd}",TransGrid.CurrentRow.Cells["Trans_Date"].Value);



我认为这可能对您有帮助



I think this may help you


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

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