Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 July 9th, 2013, 04:10 PM
Friend of Wrox
Points: 1,905, Level: 17
Points: 1,905, Level: 17 Points: 1,905, Level: 17 Points: 1,905, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default modify date column

If you have a date column in your gridview that displays like:
9/27/2011 9:00:35 AM

And would rather have it displayed like in the MM-DD-YYYY format instead, how do you set that up in the grid so that displays in the format that you want it to.

Thanks once again





98783 Points

9691 Posts

Moderator

Sorry I found the answer to this question already:
Re: DateTime Format in gridview colum

Jun 21, 2006 12:22 PM|LINK


Sure, if you're using a BoundField, simply do as follows:
<asp:boundfield datafield="Your_Date_Column" dataformatstring="{0:MMMM d, yyyy}" htmlencode="false" /> Just make sure you set the HtmlEncode attribute to False or it won't work.

Last edited by vbboyd; July 9th, 2013 at 04:30 PM..




Similar Threads
Thread Thread Starter Forum Replies Last Post
how to modify built in php's date function sandeepgreaternoida BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 April 1st, 2009 07:44 AM
sorting on date column in XSLT Palwi XSLT 1 March 18th, 2008 07:19 AM
Moving date from one column to another mattastic SQL Server 2000 2 October 6th, 2005 03:16 PM
re: modify the column in a xml file ramya General .NET 1 January 20th, 2005 04:50 AM
date column yagiroy SQL Server 2000 2 June 14th, 2003 01:19 PM





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