edit Dateformat to yyyy-mm-dd


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var date = new Date();
  2. var d = date.getDate();
  3. var day = (d < 10) ? '0' + d : d;
  4. var m = date.getMonth() + 1;
  5. var month = (m < 10) ? '0' + m : m;
  6. var yy = date.getYear();
  7. var year = (yy < 1000) ? yy + 1900 : yy;
  8.  
  9. document.write(day + "/" + month + "/" + year);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.