How to Change Formatting of SharePoint List's Date Type Column using javascript

Change Formatting of SharePoint List's Date Type Column using javascript

SharePoint list's date type column gives us date in the below format :-

2020-04-02T20:17:46.384Z

You can modify this format according to your need, below is an explanation of this - 

$.each(data.d.results, function(key, value) {         
          var d = value.Created.substring(0, value.Created.lastIndexOf("T"));
          var year = d.split("-")[0];
          var month = d.split("-")[1];    
          var day = d.split("-")[2];

            alert(day +"-"+ month +"-"+ year);           
            
          }
        }); 


Output Date format would be :- 02-04-2020


Comments

Popular posts from this blog

How to Customize exported excel's cell background color in Datatables

Populate dropdown using jquery ajax in SharePoint

Customizing SharePoint list and implementing Quick search using jQuery