Skip to content

Instantly share code, notes, and snippets.

@Edwardtonnn
Created April 2, 2018 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Edwardtonnn/8865c9cc6086f42a12b1d48348c449df to your computer and use it in GitHub Desktop.
Save Edwardtonnn/8865c9cc6086f42a12b1d48348c449df to your computer and use it in GitHub Desktop.
jquery and javascript date function
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()
);
<div class="date"></date>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment