The browser displays the following dirty trick

Этот текст представляет данные, полученные в результате работы PHP 5: Сегодня 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 'UTC' for '6.0/no DST' instead in C:\SERVER\Apache\htdocs\phpstud\simple01.php on line 8

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 'UTC' for '6.0/no DST' instead in C:\SERVER\Apache\htdocs\phpstud\simple01.php on line 8

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 'UTC' for '6.0/no DST' instead in C:\SERVER\Apache\htdocs\phpstud\simple01.php on line 8 09-23-2011

Code such

 <html> <head> <title>Web-страница</title> </head> <body> Этот текст представляет данные, полученные в результате работы PHP 5: Сегодня <?php $todaysdate = date("m", time()) . "-" . date("d", time()) . "-" . date("Y", time()); echo $todaysdate; ?> </body> </html> 

Where is the mistake? It seems to me that something with a date in php may need to be configured.

  • enter in google - date_default_timezone_set () and read info - Palmervan

2 answers 2

Set the time zone:

 date_default_timezone_set("Europe/Moscow"); 
     $todaysdate = date("dmY", time()); echo $todaysdate; // Виведет 23-09-2011 

    About the letters, what they mean and which ones it is possible to use, look either in the book or on the Internet - there are a lot of them, both the letters of time and the date. And you can change as you like, for example, like this: d/m/y or how you have m/d/Y , this is the month, day and year with four characters. This variable will display the date of the one that now, if you want to format another date that you have, you need to change time () to your variable.