hi , it just echos : the path of the php.ini file, it shows : D:/windows/php.inivolka wrote:I stand corrected.You should do that instead of fiddeling with the timestamp.aaronhall wrote:Try adjusting the date.timezone directive in php.ini (http://www.php.net/manual/en/ref.dateti ... e.timezone)
tells you which php.ini you have to change.Code: Select all
<?php echo get_cfg_var('cfg_file_path'); ?>
Don't forget to restart the webserver after changing the php.ini
Time not displaying properly with php 5.1.2
Moderator: General Moderators
- sarav_dude
- Forum Newbie
- Posts: 24
- Joined: Sun Apr 30, 2006 8:40 am
- Location: India
- Contact:
- sarav_dude
- Forum Newbie
- Posts: 24
- Joined: Sun Apr 30, 2006 8:40 am
- Location: India
- Contact:
Just because someone cries bug it's not necessarily a bug
http://bugs.php.net/bug.php?id=34475 wrote:Status: Bogus
Version: 5.1.0RC2
As stated that's the php.ini you have to change.sarav_dude wrote:hi , it just echos : the path of the php.ini file, it shows : D:/windows/php.ini
Last edited by volka on Wed May 02, 2007 2:08 am, edited 2 times in total.
- sarav_dude
- Forum Newbie
- Posts: 24
- Joined: Sun Apr 30, 2006 8:40 am
- Location: India
- Contact:
I found the solution my problem
I found the solution my problem, just setting the timezone to and subtracting one hour from that to display the correct time .
Code: Select all
date_default_timezone_set('Indian/Cocos');If you write the timezone to the php.ini as described in http://www.php.net/manual/en/ref.dateti ... e.timezone you don't have to call date_default_timezone_set() in each and every script.
If you still need to add an extra hour it's either the wrong timezone or the zoneinfo of your os needs an update.
If you still need to add an extra hour it's either the wrong timezone or the zoneinfo of your os needs an update.
- sarav_dude
- Forum Newbie
- Posts: 24
- Joined: Sun Apr 30, 2006 8:40 am
- Location: India
- Contact:
Yes you are right , may be some kind of update needed to my os as well as php, also i have checked the link given by you , it is good, but i was unable to find the settings mention on that page in my php.ini file , may be php needs an update, all the following settings are not present in my php.ini.
Code: Select all
date.default_latitude
date.default_longitude
date.sunrise_zenith
date.sunset_zenith
date.timezoneAdd them as you need them. If a parameter is missing from php.ini its default value is used
date.timezone was introduced in php 5.1.0, just add the line date.timezone = 'Indian/Cocos' to D:/windows/php.ini, then restart the webserver.
When I runit prints
date.timezone was introduced in php 5.1.0, just add the line date.timezone = 'Indian/Cocos' to D:/windows/php.ini, then restart the webserver.
When I run
Code: Select all
<?php
$timestamp = time();
echo "<pre>\n";
echo 'timestamp: ', $timestamp, "\n";
foreach( array('UTC', 'Europe/Berlin', 'Indian/Cocos') as $tz ) {
date_default_timezone_set($tz) or die('date_default_timezone_set('.$tz.') failed');
echo date("H:i:s T = \U\T\CO", $timestamp), "\n";
}
echo "\n</pre>";
?>is it about 2pm where you're living?timestamp: 1178090884
07:28:04 UTC = UTC+0000
09:28:04 CEST = UTC+0200
13:58:04 CCT = UTC+0630
- sarav_dude
- Forum Newbie
- Posts: 24
- Joined: Sun Apr 30, 2006 8:40 am
- Location: India
- Contact:
Do you live on Cocos (Keeling) Islands?
- sarav_dude
- Forum Newbie
- Posts: 24
- Joined: Sun Apr 30, 2006 8:40 am
- Location: India
- Contact:
yes , i have just set , and it is working fine now, thanks
Code: Select all
ini_set("date.timezone","Indian/Cocos");- sarav_dude
- Forum Newbie
- Posts: 24
- Joined: Sun Apr 30, 2006 8:40 am
- Location: India
- Contact:
no sir , i live in india and as i mentioned before there is one hour difference with the setting "Indian/Cocos", so i subtract one hour to display the correct time.
yes i have put the settings in the php.ini file in my local system, but for my online site i have to use ini_set because i guess hosting server which is in USA wont allow to change their ini settings ...
yes i have put the settings in the php.ini file in my local system, but for my online site i have to use ini_set because i guess hosting server which is in USA wont allow to change their ini settings ...
I probably misunderstood
Do you want the time settings for Cocos (Keeling) Islands?
Cocos (Keeling) Islands is in the timezone UTC+06:30
UTC currently is 08:12:01 <-> it's 14:42:01 on Cocos (Keeling) Islands
volka wrote:Do you live on Cocos (Keeling) Islands?
Let me ask you again: Do you live on Cocos (Keeling) Islands?sarav_dude wrote:yes , i have just set, and it is working fine now, thanksCode: Select all
ini_set("date.timezone","Indian/Cocos");
Do you want the time settings for Cocos (Keeling) Islands?
Cocos (Keeling) Islands is in the timezone UTC+06:30
UTC currently is 08:12:01 <-> it's 14:42:01 on Cocos (Keeling) Islands
- sarav_dude
- Forum Newbie
- Posts: 24
- Joined: Sun Apr 30, 2006 8:40 am
- Location: India
- Contact:
sorry i forget to mentioned that i have search for timezone for the indian timings but i did not found that , so i used the one "indian/cocos" as it is closer to the indian timings what i needed , the "indian/cocos" timings are 2:49 pm and indian timings are 1:49 pm , so i subtract one hour from it to display the correct timingsvolka wrote:I probably misunderstoodvolka wrote:Do you live on Cocos (Keeling) Islands?Let me ask you again: Do you live on Cocos (Keeling) Islands?sarav_dude wrote:yes , i have just set, and it is working fine now, thanksCode: Select all
ini_set("date.timezone","Indian/Cocos");
Do you want the time settings for Cocos (Keeling) Islands?
Cocos (Keeling) Islands is in the timezone UTC+06:30
UTC currently is 08:12:01 <-> it's 14:42:01 on Cocos (Keeling) Islands
Asia/Calcutta and Asia/Colombo might be suitable, both have an offset of 19800 (seconds=5,5hours) and no daylight saving time.
Code: Select all
<?php
$timestamp = time();
echo "<pre>\n";
echo 'timestamp: ', $timestamp, "\n";
$zones = array(
'Asia/Calcutta',
'Asia/Colombo'
);
foreach( $zones as $tz ) {
date_default_timezone_set($tz) or die('date_default_timezone_set('.$tz.') failed');
echo date("H:i:s T = \U\T\CO", $timestamp), "\n";
}
echo "\n</pre>";
?>timestamp: 1178095755
14:19:15 IST = UTC+0530
14:19:15 IST = UTC+0530