Created
September 12, 2013 10:03
-
-
Save klarstil/6535288 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
var randomDate = function() { | |
var now = new Date(), | |
minMonth = 1, maxMonth = now.getMonth(), | |
minDay = 1, maxDay = 26, | |
randMonth, randDay, date; | |
randMonth = Math.floor(Math.random() * (maxMonth - minMonth + 1) + minMonth); | |
randDay = Math.floor(Math.random() * (maxDay - minDay + 1) + minDay); | |
date = new Date(2013, randMonth, randDay); | |
return (date.getDate() > 9 ? '' : '0') + date.getDate() + '.' + (date.getMonth() > 9 ? '' : '0') + date.getMonth() + '.' + date.getFullYear(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment