GridView中日期问题 [英] Problem on date in a gridview

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

问题描述

大家好.
我在gridview中遇到问题.
如何删除日期表中的时间.

当我更改日期时.
时间总是12:00 Am

我只想要日期.
但是当我编辑日期时.
我总是有时间在桌子上.

如何删除它.

非常感谢.



-chaosgray-

hello guys.
im have a problem in my gridview.
how can i remove the time in my date table.

when i change the date.
the time is always 12:00 Am

i want only the date.
but when i edit the date.
i always having the time on my table.

how can i remove it.

thanks alot.



-chaosgray-

推荐答案

使用
<asp:BoundColumn DataField="myDate" DataFormatString="{0:
MM/dd/yyyy}" HeaderText="Date"></asp:BoundColumn>


,如果您要通过查询获取数据

那么您可以写为

从表名称中选择Convert(varchar,date,103)作为Date

并且如果您想要其他日期格式,则u可以根据您的选择使用
if you are fetching data with query

then you can write as

select Convert(varchar,date,103) as Date from table name

and if you want other date format the u can use as per your choice


通过搜索google或任何搜索引擎网站.
By searching google or any search engine site.


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

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