Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery format date

function formatDate(date) {
     var d = new Date(date),
         month = '' + (d.getMonth() + 1),
         day = '' + d.getDate(),
         year = d.getFullYear();

     if (month.length < 2) month = '0' + month;
     if (day.length < 2) day = '0' + day;

     return [year, month, day].join('-');
 }
 alert(formatDate('05/08/2015'));
Source by www.codeproject.com #
 
PREVIOUS NEXT
Tagged: #jquery #format #date
ADD COMMENT
Topic
Name
7+4 =