Jump to content

Archived

This topic is now archived and is closed to further replies.

wwfc_barmy_army

date_default_timezone_set() Problem

Recommended Posts

Hello.

I have been developing a site on my personal webserver on my computer but today i went to make it live on the net but i am getting this error on my server but not on my personal webserver:

[quote]Fatal error: Call to undefined function: date_default_timezone_set() in /home/rpgsfind/public_html/site.php on line 72[/quote]

It's with this bit of code:
[code=php:0]
<?php
date_default_timezone_set("US/Eastern");

list($year, $mon, $day) = explode('-', $qry[4]);

$sevenDays = (7 * 24 * 60 * 60); // 604,800 seconds in 7 days
$entryTime = strtotime("$year-$mon-$day");
$now = strtotime("now");

if (($now - $entryTime) < $sevenDays)
{
echo "<img src='images/new.gif'>";
}
?>
[/code]

Why isn't it working on the live server, do i need to change something? any advice is welcome.

Thanks.

Peter.

Share this post


Link to post
Share on other sites
Make sure the PHP version you're using on the site is greater than or equal too Version 5.1.0

Create a file on the site called phpinfo.php and have it look like this:

[code]<?php
  phpinfo();
?>[/code]

When you run it, it should produce the info you're after.

Regards
Huggie

Share this post


Link to post
Share on other sites
Yes, I'm afraid so.

If you look at the page in the manual for [url=http://uk.php.net/manual/en/function.date-default-timezone-set.php]date_default_timezone_set()[/url] you'll see it only works with versions later than 5.1.0

Regards
Huggie

Share this post


Link to post
Share on other sites
There's no advantage of having php4 over php5, otherwise they wouldn't have released 5 :)

As for updating, as PHP6 development is well under way and PHP5 has been out for a long time, I'd say if you have the option to upgrade then do.  Unfortunately I don't have that option as I use hosted services as opposed to my own.

I'm sure others will come to the party and chip in their two cents if I've advised incorrectly though.

Regards
Huggie

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.