Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 20th, 2005, 12:06 AM
Authorized User
 
Join Date: Mar 2005
Posts: 36
Thanks: 2
Thanked 1 Time in 1 Post
Default Formatting the date field in Data Grid

Hello,
I am reading data from Excel sheet (select * from workshee)and binding the data set to grid. I hava a date field in the excel sheet and while showing the date in grid it is coming as date time format. I want the grid to show only the date not time. How can I format the grid to show the date only? I cannot change the select statement. So I need a solution which can change the formatting in the grid.
 
Old April 20th, 2005, 01:00 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

Hi Check out this article..This is regarding formatting datatime in datagrid..
http://www.c-sharpcorner.com/Code/20...taGridData.asp


 
Old April 21st, 2005, 04:01 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

you can format the data in the grid by using a DataFormatString

Code:
<asp:BoundColumn DataField="TxnDate" HeaderText="Date" DataFormatString="{0:dd-MMM-yyyy hh:mm}"></asp:BoundColumn>
Regards
Ganesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Field Validation in an Editable Data Grid Shadane ASP.NET 1.0 and 1.1 Basics 3 October 2nd, 2006 09:02 AM
formatting integer field gloribel Crystal Reports 1 October 13th, 2005 12:27 PM
Formatting Querystring Field Name realgone_ VBScript 4 September 23rd, 2004 07:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.