BBU MESSAGE FORUM + NEWS + RSS UPDATES View new messages in your reader RSS
Homepages for Salons and Spas Online Appointment Systems
Salon & Spa Message Forum Welcome to
Hair Say Newsroom


Welcome Guest
Please login or register
Home Help Search Login Register
Beautybyus.com  |  Members  |    Live Help  |  Free E-mail  |  RSS Newsroom  |  RSS Headlines  |  RSS Forum  |  May 13, 2008
Hair Say Newsroom : RSS Feed Item7 _ Feb 23/05
News Source
Hair Say

When and How to Display Time on a Website

Wednesday, February 23, 2005 Posted: 13:14 PM (EST)


Are websites designed for 90% of your viewing audience good enough? I think not. In a recent conversation with a self-proclaimed webmaster I brought to his attention that using client-side JavaScript to display the current time and date was basically flawed. The webmaster's response was that 90% of computer users have their computer clocks properly set to the correct time.

Displaying the time and date is a good thing. It helps to reinforce in the mind of the browser that they are viewing fresh and up to date content. But if that time or date is incorrect, the browser will see this as an indicative flaw and it will reflect badly on your website and its content.



When a designer uses client-side JavaScript to display the time and date, they rely on the clock time of the browser's computer. If that user does not have their computer clock set to the correct time and date then the time displayed on your web page will also be incorrect.

The only way to ensure that the proper date is displayed on your web page is not with the use of client-side scripting, but by using server-side scripting, such as ASP or PHP. By using the server-side method, the time and date will be based on the clock time of the server and not on the clock time of the visitor's computer. I have much more faith in server administrators to maintain the proper clock time and date on their computers than I do in the general browsing public.

But server-side scripting also has a flaw. You don't know in which time zone your website visitor resides, and the server time is always set to the time zone in which the server is located. So if someone from -8 GMT were to visit a website on a server located in -4 GMT, then the time displayed to that user would be incorrect by 4 hours. In the same breath, someone from the other side of the world could see a full one day difference in the date.

Time Display Code : PHP
<?
$timestamp = time();
$date_time_array = getdate($timestamp);
$hours = $date_time_array["hours"];
$minutes = $date_time_array["minutes"];
$seconds = $date_time_array["seconds"];
$month = $date_time_array["mon"];
$day = $date_time_array["mday"];
$year = $date_time_array["year"];
$timestamp = mktime($hours + 1, $minutes,$seconds ,$month, $day,$year);
echo strftime( "%b %d, %Y",$timestamp);
?>

The only way to present the correct time and date on a web page is after a user has logged into your website and after they have correctly allowed for any time difference by making an adjustment in their personal settings. For this reason I will only use server-side scripting and I will only display the date , and not the time , on pages where users do not login. For me, every hit counts and I want 100% of my visitors from this side of the world to see the correct date. And as a business owner so should you.



Ron Poole is the managing editor of Hair Say Headlines and Hair Say Newsroom.
Copyright 2005 Beauty By Us Inc. All rights reserved. This material may not be published, broadcast, rewritten, or redistributed.


Top
People Online
3 Guests, 1 Member
Magic


NoWhere Radio.com
INDIE MUSIC & HOSTING

 Yahoo!
Homepages and Online Appointment Systems
Powered by MySQL Powered by PHP BBU Online Appointment System Forum
Powered by SMF 1.0.2.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!

Beauty By Us Inc.
Kingston Ontario Canada K7K 6K8
Serving North America   (613) 547-3358

W3C P3P Compliant | PIPEDA Compliant