php - What is the rationale behind "It is not safe to rely on the system's timezone settings"? -


in python can do

import datetime print datetime.datetime.now().strftime('%y-%m-%d') # prints `2014-06-27`.  

similarly, in node.js:

console.log(new date().todatestring()); // fri jun 27 2014 

when try same in php:

<?php print date('y-m-d'); ?> 

i'm getting this

warning: date(): not safe rely on system's timezone settings. required use date.timezone setting or date_default_timezone_set() function. in case used of methods , still getting warning, misspelled timezone identifier. selected timezone 'utc' now, please set date.timezone select timezone. in ....

what rationale behind message? why don't python or node bother? "unsafe" using system timezone?

since there many posts regarding error, please read carefully : i'm not asking how fix (pretty obviously), i'm wondering why i'm getting message in first place.

php traditionally used web development, 1 plausible reason consumers of web service not in same time zone time zone server hosted in, , presumably configured (in terms of system time).

the warning makes sense in context of users of system seeing correct time on client side.

there discussion of here mentions justification gave above. justification same page, presumably php language developer.

no - you, admin, required make informed decision on want timezone be. there have been way many bug reports people had no clue, throw warning.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -