Last active
January 6, 2016 00:21
-
-
Save erberg-snippets/7204005 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
/** | |
* Creates a simple date string from a Date object. | |
* @param {Date} dateVariable Any date object. | |
* @return {String} String representation of date in format mm-dd-yyyy | |
*/ | |
function convertDateToString(date) { | |
var day = date.getDate(); | |
var month = date.getMonth() + 1; //Months are zero based | |
var year = date.getFullYear(); | |
return month + "-" + day + "-" + year ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment