Created
December 15, 2021 09:31
-
-
Save Merazsohel/4251f28e77dd23a085f32698a1c12239 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pad2(n) | |
{ | |
return (n < 10 ? '0' : '') + n; | |
} | |
var date = new Date(date goes here); | |
var month = pad2(date.getMonth()+1); | |
var day = pad2(date.getDate()); | |
var year= date.getFullYear(); | |
var formattedDate = day+"-"+month+"-"+year; | |
alert (formattedDate); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment