i wanna add date in my form..
so i do with my code like this

 $sql_updTenant = "UPDATE md_tenant SET
             modifieddt = '".date('Y-m-d H:i:s')."'";

and in my php.ini, i already change this:

; Defines the default timezone used by the date functions
;date.timezone = 

to this:

; Defines the default timezone used by the date functions
;date.timezone = Asia/Kuala_Lumpur

then i restart the server..
but when i tried to fill up my form, it still give me an error:

Strict Standards: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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 '8.0/no DST' instead in C:\AppServ\XXX\XXX\XXXX

actually i want the function date() will read the server..

What can i do to solve this problems...

Member Avatar for diafol

METHOD 1:

either do this:

date_default_timezone_set('Asia/Kualar_Lumpur');

METHOD 2:

or uncomment the line in php.ini from this:

;date.timezone = Asia/Kuala_Lumpur

to this:

date.timezone = Asia/Kuala_Lumpur

then restart the server.

No need to restart server with method 1 but you need to state it in every page where you use date functions.
Method2 - after manual change, restart the server - BUT - this will then be the default TZ.

which method is the best? But if my user use server out from malaysia, lets say Amerika, do the date will give an error.?

and for my code, do i just use this:

   sql_updTenant = "UPDATE md_tenant SET
        modifieddt = '".date('Y-m-d H:i:s')."'";

is this code correct?

and also, i just realized that i have two php.ini
1. php.ini-dist
2. php.ini-recommended

which php.ini do i need to change?

Member Avatar for diafol

No - you keep the time to what YOU want it to be for now. I'd change the php.ini.

You need to rename the one you want to php.ini. I can't tell you which one to use - but recommended sounds OK for now.

If you upload your site to a shared host - you may find that you don't have access to php.ini anyway. You may have to use the settings determined by your host.

Thanks guys..now i get it..hehe..
thanks a lot..

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.