print date("l F jS Y", strtotime('+14 hours'));
Main Topics
Browse All TopicsHello,
Thanks for reading our question! We would like to be able to show the date in our timezone, which is different from the server's timezone. We found a script that should do what we like. But, we do not know what parts to remove, and so the script is not functioning for us? Please could one of you kind experts delete all the exrtraneous lines from the code below and leave us with just the working parts. Our server offset should be 14 hours ahead. If possible, please could you make it so that it shows just the date, not the time. Could the date format be:
Long Day Long Month Day Number Long Year
Ex.
Friday July 16th 2004
Many thanks,
Yunkaa
<?php
// melbdate.php3
// rename file extension from .txt to .php3
// or to .php (updated April 2003)
// Script copyright (C) 2000 Dean Kennedy, Terrabyte Communications
// Version 1.02 06 November 2003
// Free to use, modify and copy so long as you leave the above
// two lines in comments. You can safely delete all other comments
// and just leave the four line script
// Distributed under the terms of the GNU General Public License (GPL).
// Because it is licensed free of charge, there is NO WARRANTY, it is
// provided AS IS. The author can not be held liable for any damage that
// might arise from the use of this software. Use it at your own risk.
// http://www.gnu.org/copylef
// To adjust the format of the date, see the list of variables at the
// official PHP site (php.net): http://www.php.net/manual/
//
// If your local time is *behind* the server time, then change the "+" to
// a "-" in the $melbdate line
//
// Keep in mind that you'll have to update the $hourdiff variable within the
// script when your *local* daylight saving time/standard time changes, if
// it is a different setting to the server daylight saving/standard time
// Variable for hours
$hourdiff = "14"; // hours difference between server time and local time
// If you don't know how many hours, then "uncomment" the three lines
// below by deleting "// " to see what the server time is (remember to
// put the comments "// " back when you've finished checking:
// $serverdate = date("l, d F Y h:i a");
// print ("$serverdate");
// print (" <p>");
// Nothing needs to be changed below here unless you want to change
// the format of the date (see above for URL of options) or your local
// time is behind the server time
$timeadjust = ($hourdiff * 60 * 60);
$melbdate = date("l, d F Y h:i a",time() + $timeadjust);
print ("$melbdate");
?>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Er, there isn't anything more to say! The line of code I gave you does exactly what you asked for!
I guess if you want to make it slightly more like your original code you could say:
$hourdiff = '+14 hours';
print date("l F jS Y", strtotime($hourdiff));
Really not the kind of thing I'd bother putting under a GPL! Takes longer to paste the license than to write the code!
I'd hope that you have ntpd running on your server.
hello Squinky,
Thanks so much for answering our question!! Not really so new, but terrifically computer challenged :p :). Here is the code we are using:
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<?php print date("l F jS Y", strtotime('+14 hours')); ?>
</body>
</html>
Are we doing this correctly? When we use this, the page just comes up blank .
Many thanks,
Yunkaa
Business Accounts
Answer for Membership
by: ldbkuttyPosted on 2004-07-16 at 02:24:22ID: 11566648
<?php
$hourdiff = "14"; // hours difference between server time and local time
// If you don't know how many hours, then "uncomment" the three lines
// below by deleting "// " to see what the server time is (remember to
// put the comments "// " back when you've finished checking:
// $serverdate = date("l, d F Y h:i a");
// print ("$serverdate");
// print (" <p>");
// Nothing needs to be changed below here unless you want to change
// the format of the date (see above for URL of options) or your local
// time is behind the server time
$timeadjust = ($hourdiff * 60 * 60);
$melbdate = date("l, d F Y",time() + $timeadjust);
print ("$melbdate");
?>