Sweet jQuery Date Function That Will Blow Your Mind


jQuery Date Function

People have a hard time fighting shinny object syndrome.

Shinny Object Syndrome is when you can't resist the new product even though you currently own the previous version.

Take Apple products for instance. Peeps wait in line to get the new iPhone even when their current iPhone still works.


Adding a date to your sales makes it look new and fresh.

Dates give factual data and work great with time constraint calls to action.

You see this example all the time in advertorials.


This little jQuery date function is super easy to use.

Simply add the jquery script just above the </body> tag.

$(function() {
var d = new Date();
var weekday = new Array();
weekday[0]= "Sunday";
weekday[1] = "Monday";
weekday[2] = "Tuesday";
weekday[3] = "Wednesday";
weekday[4] = "Thursday";
weekday[5] = "Friday";
weekday[6] = "Saturday";
var month = new Array();
month[0] = "January";
month[1] = "February";
month[2] = "March";
month[3] = "April";
month[4] = "May";
month[5] = "June";
month[6] = "July";
month[7] = "August";
month[8] = "September";
month[9] = "October";
month[10] = "November";
month[11] = "December";
var daydate = weekday[d.getDay()]+", "+month[d.getMonth()]+" "+d.getDate()+", "+d.getFullYear();
var date = month[d.getMonth()]+" "+d.getDate()+", "+d.getFullYear();

Then add this code snippet where you want the date to appear on your landing page.

For a date format like: Monday May 23, 2018

Use <span class=”daydate”></span>


Far a date format like: May 23, 2018

Use <span class=”date”></span>


Need help? Ask a question or comment.

Add Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This