locked
How to show the Jquery Date Column in the format of MM / DD / YYYY RRS feed

  • Question

  • User-513593581 posted

    Dear All,

    Below function is working fine for me on DD / MM / YYYY .
    But now my client is asking for the format of MM / DD / YYYY . Can any one please help me what should I modify in below code.

      function sortDatePlugin(){
              alert("hello");
           	$.fn.dataTable.moment = function (format,locale){
           		var types = $.fn.dataTable.ext.type;
           		// Add type detection
           		types.detect.unshift( function ( d ) {
           			return moment( d, format, locale, true ).isValid() ? 'moment-'+format : null;
           		});
           		// Add sorting method - use an integer for the sorting
           		types.order[ 'moment-'+format+'-pre' ] = function ( d ) {
           		 	return moment( d, format, locale, true ).unix();
                
           		};
           	};
           	$.fn.dataTable.moment('DD/MM/YYYY');
           }

    Thursday, March 29, 2018 5:32 PM

All replies