Hi everyone
I want to set timezone (US/Central). It is working fine on my local computer but when I upload the code on web server It is giving me error
Fatal error: Call to undefined function: timezone_open() in
Here is the code -
$tz1 = timezone_open("US/Central");
-
$ts = date_create("2008-08-19 12:19:21", $tz1);
-
echo $ts->format(DATE_RFC822), "<br/>";$ts->setTimezone($tz1);
If anyone could help me
Regards
7 2777
what php version does the server use? timezone_open() requires PHP 5.1.0 at least.
Hi all,
I have the same error log: - Fatal error: Call to undefined function: timezone_open() in
with simple script: - <?php
-
$t=time();
-
echo($t . "<br />");
-
$date = timezone_open($t);
-
echo $date;
-
?>
and PHP 5.2.14 (cli) (built: Aug 27 2010 16:40:16)
Can someone give me a tip?
Best,
Biliards.
Atli 5,058
Expert 4TB
Are you 100% sure about that version number? (A 110% sure?) - I've lost count how many hours I've wasted because I assumed things like that without properly testing for it :)
That said, did you try bypassing the alias function and just using the normal OOP method? - <?php
-
$d = new DateTimeZone(time());
-
echo $d;
-
?>
Hi Atli,
yes, I'm sure: - # php -v
-
PHP 5.2.14 (cli) (built: Aug 27 2010 16:40:16)
-
Copyright (c) 1997-2010 The PHP Group
-
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
-
with the ionCube PHP Loader v3.1.29, Copyright (c) 2002-2007, by ionCube Ltd.
-
I try your script and I obtain this error log - PHP Fatal error: Class 'DateTimeZone' not found
I don't understand why
Atli 5,058
Expert 4TB
That's really odd. According to the manual entry for that class it is supposed to be built into the PHP core since 5.2.0. Could it be that there is something special about your build? How did you install it?
Also, looking at this more closely, you are not using the class as it should be used. The constructor takes a timezone name, not a timestamp. That is, you should pass it a string like: "GMT", "UTC", or even something like: "Iceland" or "America/New_York".
Are you using the CLI PHP binary to test this, or are you testing through your webserver? Many times have we seen people give us the version of their CLI PHP binary, assuming it to be the same as the binary used by their webserver (it is typically not).
I'm sorry if I used the class as it should be used.
Now, before to reply to thred, I used other Centos5 server with PHP4 and I used these command-line: - # yum update
-
# php -v
-
PHP 5.1.6 (cli) (built: Mar 31 2010 02:44:37)
-
Copyright (c) 1997-2006 The PHP Group
-
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
-
# more test.php
-
<?php
-
$date = timezone_open('UTC');
-
echo $date;
-
?>
-
# php test.php
-
PHP Fatal error: Call to undefined function timezone_open() in ... on line 2
So that I used two guides:
* wiki.centos.org to update PHP from 5.1.6 to 5.2.10 but I had again the error log
* jasonlitka.com to update PHP from 5.2.10 to 5.2.14 but I had again the error log
Update from 5.1.6 to 5.2.10 was completed only after I erased php-sqlite2 (yum erase php-sqlite2).
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Google Mike |
last post by:
I guess I'm confused by the whole timezone thing and I don't want to
write a web app that gets this stuff wrong. I don't know how timezones
work exactly -- is it just hours +/- on GMT or are there...
|
by: Anony Mous |
last post by:
Hi,
Is there a function that would allow me to set the local time while the
server is running? I can't seem to find anything on this...
Thanks,
Peter
---------------------------(end of...
|
by: Varangian |
last post by:
Hello there,
I'm having a problem with Utcnow property. I'm checking the Utcnow for
IsDayLightSaving() if true or false. I'm setting the timezone to GMT
time London etc and during summer when...
|
by: Ken Varn |
last post by:
I have a managed C++ method that I call from ASP.NET to set the time zone on
the local box. I call SetTimeZoneInformation, which does not return an
error, but the time zone remains unchanged. I...
|
by: Ramon |
last post by:
Hello,
when I send an email using the mail() function, I get a Runtime Notice:
date() : It is not safe to rely on the system's timezone
settings. Please use the date.timezone setting, the TZ...
|
by: jrhastings |
last post by:
I know there are many threads on this topic but I haven't yet found an
answer to this question. I'd like to map from a utc to a local time in
an arbitrary timezone (not necessary the default local...
|
by: JJ |
last post by:
I'm having problems trying to publish an ASP.NET project from VS2005 and was
hoping to get some pointers in the right direction.
The project works fine from my development system using the...
|
by: helloitsme |
last post by:
Hello All!
I know there already exists a thread with this topic by Mike! But my problem did not get solved with that....
I have a working code in VB6 that can set the selected timezone for the...
|
by: mac11 |
last post by:
I have an app that runs under Linux (centos and LFS flavors) and I'm having problems with reading the correct time after I change the timezone (by moving the link at /etc/localtime to point to the...
|
by: Looch |
last post by:
All,
I'm using a WinForm app that calls methods on a remotable object. The
app server hosting the object is in New York. Using the same exact
application, a Sql Server 2005 datetime column's...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |