SQLDataSource返回“mm / dd / yyyy hh:mm:ss”同时从数据库中提取Date数据类型 [英] SQLDataSource returns "mm/dd/yyyy hh:mm:ss" while retriving Date datatype from Database
本文介绍了SQLDataSource返回“mm / dd / yyyy hh:mm:ss”同时从数据库中提取Date数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个属性,日期,数据类型的表。我使用 SqlDataSource
从数据库获取数据并填充 GridView
,并以mm / dd / yyyy hh :mm:ss格式。
但在数据库中,它以mm / dd / yyyy格式存储。
应该改变什么?
解决方案
试试这个
< asp:BoundField HeaderText =DateDataField =DBDate
DataFormatString ={0:MM / dd / yy}>
I have a table with attribute, date, datatype. I use SqlDataSource
to get the data from database and fill the GridView
with it displays in " mm/dd/yyyy hh:mm:ss" format.
But in database it is stored in "mm/dd/yyyy" format. What should be changed ?
解决方案
Try this
<asp:BoundField HeaderText="Date" DataField="DBDate"
DataFormatString="{0:MM/dd/yy}">
这篇关于SQLDataSource返回“mm / dd / yyyy hh:mm:ss”同时从数据库中提取Date数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文