Page 3 of 3

Thats cool

Posted: Wed May 02, 2007 5:33 am
by sarav_dude
volka wrote: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
Yes that was cool, it works perfectly thank you very much ....i have used now

Code: Select all

date_default_timezone_set('Asia/Calcutta');
and its perfect, thats what i m searching for.

Posted: Wed May 02, 2007 8:30 am
by volka
Maybe you're allowed to change the value via .htaccess. But that depends on your provider.
The line

Code: Select all

php_value date.timezone Asia/Calcutta
would set date.timezone=Asia/Calcutta for all scripts in that directory and all sub-directories.
If you have many scripts that rely on the timezone setting you'd better ask your provider wether you can use htaccess for this or not.
On the other hand there's nothing wrong with date_default_timezone_set.

Posted: Thu May 03, 2007 1:14 am
by sarav_dude
Thats a very good idea , i will ask the hosting personnel about the use for htaccess, i guess it is allowable , thank you very much :D