Im a little confuse with this particular function 'date()' Its a serverside time or it takes the time of the client computer?
See its shows a time that in anymeans is my current time but still when i change my pc time it also change

Recommended Answers

All 6 Replies

Perhaps this helps point you in the right direction (specifically the topic labeled 'Runtime Configuration' defined in the php.ini file)?
http://www.w3schools.com/php/php_ref_date.asp

EDIT: Found this as well... http://us2.php.net/manual/en/function.date-default-timezone-get.php seems there are several possibilities under the 'Description ' section... "If none of the above succeed, date_default_timezone_get() will return a default timezone of UTC."

Perhaps this helps point you in the right direction (specifically the topic labeled 'Runtime Configuration' defined in the php.ini file)?

Many thanks this fixed the time, now is displaying same time as my pc, but why it change when i modify my pc time? if is a deffault timezone, its not supose to change according of my pc's time right?
Thanks

The us2.php.net link I provided mentions something about the "TZ environment variable". It's possible this can be "...specified by the operating system using system wide or user specific shell profile file" (linux). I'm not sure if the same idea applies to windows/IBM, but would imagine so.

Member Avatar for Budy_1

We can set it manually in your global file, like this

ini_set('date.timezone', 'Asia/Jakarta');

We can set it manually in your global file, like this

Already set it in php.ini like PsychicTide said. but it changes based in my pc's time. How can i set it in someway that dont rely on pc's time?
Example danny web says the post was make 19 hours ago, and when i change my date is still 19 hours ago

Thanks for the help

I have no idea, but perhaps the time the post was submitted to daniweb would be a timestamp saved in a database somewhere, could then judge time since by daniweb's currently set time (comparison of current and saved server timestamp)?

just a random guess.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.