gjshah7254
5/14/2014 - 4:48 AM

Kentico change date format

Kentico change date format

<%# GetDateTime("FieldName", "D") %>

//If you are not in a transformation of kentico , you can use the below method
<%# TransformationHelper.HelperObject.FormatDateTime(Eval("DateField"), "d") %>

Options available
Below are common uses of the DateTime Structure in C#
DateTime.Now; 	10/14/2010 9:28:45 PM
DateTime.Now.ToString(); 	10/14/2010 9:28:45 PM
DateTime.Now.ToShortTimeString()	9:28 PM
DateTime.Now.ToShortDateString()	10/14/2010
DateTime.Now.ToLongTimeString()	9:28:45 PM
DateTime.Now.ToLongDateString()	Thursday, October 14, 2010

________________________________________

DateTime.Now.ToString("d")		10/14/2010
DateTime.Now.ToString("D")		Thursday, October 14, 2010
DateTime.Now.ToString("f")		Thursday, October 14, 2010 9:28 PM
DateTime.Now.ToString("F")		Thursday, October 14, 2010 9:28:45 PM
DateTime.Now.ToString("g")		10/14/2010 9:28 PM
DateTime.Now.ToString("G")		10/14/2010 9:28:45 PM
DateTime.Now.ToString("m")		October 14
DateTime.Now.ToString("r")		Thu, 14 Oct 2010 21:28:45 GMT
DateTime.Now.ToString("s")		2010-10-14T21:28:45
DateTime.Now.ToString("t")		9:28 PM
DateTime.Now.ToString("T")		9:28:45 PM
DateTime.Now.ToString("u")		2010-10-14 21:28:45Z
DateTime.Now.ToString("U")		Friday, October 15, 2010 2:28:45 AM
DateTime.Now.ToString("y")		October, 2010
DateTime.Now.ToString("dddd, MMMM dd yyyy")		Thursday, October 14 2010
DateTime.Now.ToString("ddd, MMM dd yy")		Thu, Oct 14 '10
DateTime.Now.ToString("dddd, MMMM dd")		Thursday, October 14
DateTime.Now.ToString("M/yy")		10/10
DateTime.Now.ToString("dd-MM-yy")		14-10-10