ButlerBlog

chad butler's weblog

  • About
  • Blog
  • WordPress Plugins
  • Contact

Date-O-Matic Javascript Day/Date Display

By Chad Butler Leave a Comment

This is a very simple date script that I wrote years ago. I have used it in some form or another on just about every site that I have worked on. It is a nice, simple, client-side javascript to display the day and the date.

To use it, place the following in the of your html document:


In the location that you want the date to display, place the following:

This will output the date. You can apply CSS to the output as necessary, or, for those lacking the necessary skills, you could wrap this with a (yuck!) tag.

Obviously (or maybe not so obvious), there are a number of changes one could make based on desired output. For example, the days or months could be abbreviated in the script if you wanted “Thurs, Jan 12, 2006”. Or, the more savvy could change it to an output of “Thursday – 1/12/2006” by changing the month names to appropriate numbers and then changing the document.write section to:

document.write(d[today.getDay()]+" - ");
document.write(m[today.getMonth()]+"/");
document.write(today.getDate()+"/");
document.write(""+today.getFullYear());

Or, if you need scientific or European dating, switch the date and the month lines to get this:

document.write(d[today.getDay()]+" - ");
document.write(today.getDate()+"/");
document.write(m[today.getMonth()]+"/");
document.write(""+today.getFullYear());

If you are an old javascript hack, you probably had all that figured out (or already wrote your own), but if you are a js noob, tinkering with the output and maybe adding or subtracting from it, is a good way to “get under the hood” so-to-speak and learn how to use javascript.

Have fun!

  • Facebook
  • Twitter
  • Email
  • Print
  • More
  • LinkedIn
  • Reddit
  • Tumblr
  • Pocket
  • Pinterest

Filed Under: Web Tagged With: javascript, tools, Web, webdev

Join Us!

I will never share your information. No spam. No junk. No kidding. Unsubscribe anytime.

Recent Posts:

  • YouTube Success: Key Tips for Enhancing Video Optimization and Visibility
  • Mobile App vs. Mobile Website Ideal Choice for your Business
  • Top Strategies to Boost Your Brand’s Visibility and Impact
  • Advanced Blogging Strategies: Using Analytics, A/B Testing, and Conversion Optimization Techniques to Grow Your Audience
  • Unlock Real-Time Process Insights to Save Time and Money
  • How Writers Can Attract More Audience Attention
  • Dress for Success – Even at Home
  • Mastering the Art of Crafting SMART Marketing Goals
  • Rediscover Your Brand Story: 7 Tips for Refreshing Your Company Identity
  • Creating Engaging Content: Tips for a Successful Content Marketing Strategy

Archives

  • About
  • Blog
  • Archive
  • Contact

Site powered by WordPress, running on the Genesis Framework from StudioPress.

Unless otherwise noted, content on this site is © 2006-2025 ButlerBlog and may not be reproduced without express written permission from the author.

Some content may include affiliate links for which this site receives a small commission.