Web Hosting Talk







View Full Version : how to solve warnning


elena1234
01-29-2010, 02:31 AM
Hi there, please let me know how to solve this warning
our code
<?php
echo date("Y/m/d") . "<br />";
echo date("Y.m.d") . "<br />";
echo date("Y-m-d")
?>

error
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Calcutta' for '5.5/no DST' instead in C:\xampp\htdocs\ramji\r5.php on line 2
2010/01/29

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Calcutta' for '5.5/no DST' instead in C:\xampp\htdocs\ramji\r5.php on line 3
2010.01.29

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Calcutta' for '5.5/no DST' instead in C:\xampp\htdocs\ramji\r5.php on line 4
2010-01-29

Neseema M M
01-29-2010, 02:41 AM
Use the function date_default_timezone_set() like

date_default_timezone_set('Asia/Calcutta');


This sets the default timezone by all date function.

Hope it helps.

elena1234
01-29-2010, 05:02 AM
thank for quick reply Neseema M M