Created
April 2, 2018 18:36
-
-
Save Edwardtonnn/8865c9cc6086f42a12b1d48348c449df to your computer and use it in GitHub Desktop.
jquery and javascript date function
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 monthNames = [ | |
"January", | |
"February", | |
"March", | |
"April", | |
"May", | |
"June", | |
"July", | |
"August", | |
"September", | |
"October", | |
"November", | |
"December" | |
]; | |
var dayNames = [ | |
"Sunday", | |
"Monday", | |
"Tuesday", | |
"Wednesday", | |
"Thursday", | |
"Friday", | |
"Saturday" | |
]; | |
var newDate = new Date(); | |
newDate.setDate(newDate.getDate()); | |
$(".date").html( | |
dayNames[newDate.getDay()] + | |
", " + | |
newDate.getDate() + | |
" " + | |
monthNames[newDate.getMonth()] + | |
", " + | |
newDate.getFullYear() | |
); |
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
<div class="date"></date> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment