0

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...

2
Contributors
4
Replies
6
Views
4 Years
Discussion Span
Last Post by sagisgirl
0

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.

Edited by diafol

0

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?

Edited by sagisgirl

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.