|
Printed
from BasicTips.com,
FREE helpful articles
and tips for Webmasters and Business Owners
Copyright © 1994-2006
by BasicTips.com, a division of BasicTemplates.BIZ
All rights reserved. Republication in whole or in part in any form is not permitted.
Sponsored by BasicTemplates.BIZ
Website
Templates with External CSS and
Removable Graphics
http://www.BasicTemplates.biz
Co-Sponsored by Effective-Website-Secrets.com
Teaching webmasters effective web development and marketing techniques
via free podcasts.
http://www.Effective-Website-Secrets.com
Category: Web Design
What Is The Current Date?
By BasicTemplates with External CSS
Have you ever wondered how you can display the current date to your web site visitors? Do you really need to and why would you want to? Don't your site visitors already know the date? We are often asked these questions and this is the topic of this week's article. We will also give you some free code to use should you decide it is a feature you want to use on your web site.
If you take a look at many of the leading, big-boy web sites (as we like to call them), you will notice that many of them are certainly displaying the current date. It seems to be the trendy thing to do these days and many of our web site templates include this feature. Do not take it for granted that your site visitors already know the date. The WWW is global and time zones are a big factor to consider. Also, many people work with dates far ahead in their everyday jobs, so it is often not something they are quick to know.
3 Reasons Why You May Want to Include the Current Date on Your Web Site:
1. Do you own an ecommerce site and offer limited time specials that ends on a specific date? You certainly may want to consider displaying the 'current date' feature. 2. Does your site offer information that changes on certain dates or days of the week? If so, your visitors would find it beneficial to know that today is Friday and you will be publishing new content on Monday. Don't take it for granted that people are quickly aware of the day of the week either. 3. Do you want to offer easy, trendy features to your site visitors like the big boy sites? After all, the big boy sites set the tone for what's hip and what's out of date. Offering outdated features on your site, may give your visitors the impression that your site is stagnant and not updated regularly.
There are many, many ways to display the current date. We will be using a JavaScript code snippet that is easy for you to place into your web page. The code is shown below. Simply copy/paste it into the area of your page where you want the current date to appear. An example of how it will appear on your web page is shown above.
<script language="JavaScript"> myvar = new Date(); Month = (myvar.getMonth() + 1) Year = (myvar.getYear()) if (Month == 1) {TheMonth = "January";} if (Month == 2) {TheMonth = "February";} if (Month == 3) {TheMonth = "March";} if (Month == 4) {TheMonth = "April";} if (Month == 5) {TheMonth = "May";} if (Month == 6) {TheMonth = "June";} if (Month == 7) {TheMonth = "July";} if (Month == 8) {TheMonth = "August";} if (Month == 9) {TheMonth = "September";} if (Month == 10) {TheMonth = "October";} if (Month == 11) {TheMonth = "November";} if (Month == 12) {TheMonth = "December";} document.write(TheMonth+" " +myvar.getDate()+", "+Year); </script>
If you want to change cosmetic characteristics of the current date option such as the font face, size, color and alignment, check out our CSS (cascading style sheets) tip, "Cosmetic Customizations to the "Current Date" Feature".
|