Not use if this is the right way and works for me. The various DateTime formats available are listed at DateTime formats. Assuming the default date format is "The General Date Short Time ("g") Format Specifier".
DateTimeFormatInfo dateformatInfo = Thread.CurrentThread.CurrentCulture.DateTimeFormat; string dateFormat = dateformatInfo.ShortDatePattern;
Now that we know the dateformat we are going to use is defined in a variable "dateFormat". Convert this date format string to JQGrid format.
public string ConverToJQGridDateFormat(string DateFormat) { // Day DateFormat = DateFormat.Replace("dddd", "d"); DateFormat = DateFormat.Replace("ddd", "d"); DateFormat = DateFormat.Replace("dd", "d"); // Month DateFormat = DateFormat.Replace("MMMM", "M"); DateFormat = DateFormat.Replace("MMM", "M"); DateFormat = DateFormat.Replace("MM", "m"); DateFormat = DateFormat.Replace("M", "m"); // Year DateFormat = DateFormat.Replace("yyyy", "Y"); DateFormat = DateFormat.Replace("yyy", "y"); DateFormat = DateFormat.Replace("yy", "y"); return DateFormat; }
Ok now we have got our JQGrid date format, just apply this to colmodel options. Finally the column for "Invoice date" should be rendered as
name: 'InvDate',index: 'InvDate',sorttype:'date',formatter:'date',formatoptions:{srcformat:'d/m/Y',newformat:'d/m/Y'}Another mode of accumulating power arises from lifting a weight and then allowing it to fall.
- Charles Babbage
Great Article
ReplyDeleteASP.NET MVC Training
Online MVC Training
Online MVC Training India
Dot Net Training in Chennai
.Net Online Training
.net training online
Dot Net Online Training