473,405 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

datagrid and datetime field

Is there a way to truncate the Sql Server datetime field when displaying in a
datagrid? I get the date and time, I only want date displayed.
It's a bound column:
<asp:BoundColumn HeaderStyle-CssClass="gridtext" HeaderStyle-Wrap=False
ItemStyle-CssClass="gridtext" ItemStyle-Width="20px" ItemStyle-Wrap=False
DataField="Concern_DMfgDate" HeaderText="Mfg. Date"
SortExpression="Concern_DMfgDate" />
I'm using a view in Sql Server to get the data, maybe I can do it in there?
why does it show only the date (i.e. 1/12/2001) in Sql Server but in grid
date and time show?
1/12/2001 12:00:00 AM

Thanx.
Nov 19 '05 #1
2 1629
"=?Utf-8?B?Q2hyaXM=?=" <Ch***@discussions.microsoft.com> confessed in
news:5E**********************************@microsof t.com:
Is there a way to truncate the Sql Server datetime field when displaying in a datagrid? I get the date and time, I only want date displayed.
It's a bound column:
<asp:BoundColumn HeaderStyle-CssClass="gridtext" HeaderStyle-Wrap=False
ItemStyle-CssClass="gridtext" ItemStyle-Width="20px" ItemStyle-Wrap=False
DataField="Concern_DMfgDate" HeaderText="Mfg. Date"
SortExpression="Concern_DMfgDate" />
I'm using a view in Sql Server to get the data, maybe I can do it in there? why does it show only the date (i.e. 1/12/2001) in Sql Server but in grid
date and time show?
1/12/2001 12:00:00 AM

Thanx.

Have you tried something like:

DataFormatString="{0:d}"

as a property to your Bound column?

-- ipgrunt

Nov 19 '05 #2
that worked great! Any suggestions on converting True/False to a display of
Yes/No?

"IPGrunt" wrote:
"=?Utf-8?B?Q2hyaXM=?=" <Ch***@discussions.microsoft.com> confessed in
news:5E**********************************@microsof t.com:
Is there a way to truncate the Sql Server datetime field when displaying

in a
datagrid? I get the date and time, I only want date displayed.
It's a bound column:
<asp:BoundColumn HeaderStyle-CssClass="gridtext" HeaderStyle-Wrap=False
ItemStyle-CssClass="gridtext" ItemStyle-Width="20px" ItemStyle-Wrap=False
DataField="Concern_DMfgDate" HeaderText="Mfg. Date"
SortExpression="Concern_DMfgDate" />
I'm using a view in Sql Server to get the data, maybe I can do it in

there?
why does it show only the date (i.e. 1/12/2001) in Sql Server but in grid
date and time show?
1/12/2001 12:00:00 AM

Thanx.

Have you tried something like:

DataFormatString="{0:d}"

as a property to your Bound column?

-- ipgrunt

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Marcos Rodríguez | last post by:
Hi all I have an Access Data Base containing a table which have a DateTime Field. I am creating a Windows App and I am using a DataGrid object to show data from the table using a DataSet object. My...
0
by: Bob Rosen | last post by:
The description given in "Customizing Items Dynamically in the DataList or DataGrid Web Server Control" (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vbCode/...
4
by: karunakar | last post by:
Hi All I was poplating Datagrid Datagrid has one of the column showing datetime field format iam showing DATE here not Necessary to populate the Time Frame Even my datebase column also...
1
by: web1110 | last post by:
I have a table with a field of type datetime. I am displaying this table in a datagrid. My problem is that the datetime field shows only the date and not the time. I'd appreciate some help. ...
3
by: Andrew S. Giles | last post by:
Hello, I am importing a flat text file, and putting it into a datagrid for display on a form. Currently the users have their dates and times seperated. I have two fields, therefore in the...
4
by: hennovanrensburg | last post by:
Hi all, I've noted a couple of posts regarding the speed of a datagrid in a ..net win app. My datagrid consists of 37 rows and 12 cols, and is unacceptably slow. How can this be? Should I...
1
by: Gunjan Garg | last post by:
Hello All, I am working to create a generic datagrid which accepts a datasource(ListData - This is our own datatype) and depending on the calling program customizes itself for sorting,...
1
by: Mok | last post by:
Hello, I want to pull information from a table in sql server, bind it to a grid and update those values. I would like to know the best way to do it. I used the configure data adapter wizard and it...
3
by: Tim McKinney | last post by:
I have a read-only datagrid that I use to display a heirarchal model of three tables (The example I am setting up uses the Customer, Orders, and Order Detail tables from the northwind database). I...
6
by: Marcin Wiszowaty | last post by:
Hello, I am reading into a dataset through a dataadapter. All drag+drop implementation. I have a field in the db that is a datetime(8). whenever i readin this field the datagrid displays the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.