hi,

I'm using xampp.
By using phpMyAdmin,

select now() from dual

it shows 2011-02-14 07:28:57 but suppose today's date is 2011-02-15 07:28:57
is there anyone have rough idea where the date set?

i've check the server date is correct 15 feb

thankx

It shows the date of the server, check for timezone as well.

i've select the correct time zone and still the same ..
is there any where that in the xampp set the time?

i've select the correct time zone and still the same ..

How and where you do that?

Open C:\xampp\php\php.ini file in your notepad text editor and look for this section:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "CURRENTIMEZONE"

Go to this link http://us2.php.net/manual/en/timezones.europe.php to get your time zone and replace the Europe/Helsinki with your own time zone ie. Europe/Athens so it now looks like this

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "YOURNEWTIMEZONE"
Save the php.ini file and restart Apache to have those changes recognized.

thankx Jeff
i've stop apache and found the [Date] and already change accordingly to mytimezone
then start back apache
but the time still taking US timezone.
i'm very sure that i've my computer timezone is correct.

Status = not settle yet

you can test to see what the default timezone on the server is set with the PHP command ‘date_default_timezone_get’. That should tell you what your computer is assuming is the default timezone.

result showing Asia/Kuala_Lumpur which i set at the php.ini

my task is to get the Entry date time
so when inserting to database i use now() as the input.
is there any ways to get the current date time while inserting db?

mysql is no() you are right. i think curdate() might work not sure though

it's just weird because mysql gets its date information from the local machine ?

now() ***

if using curdate() it only catch the date without time.
the worse thing is i have to get the date and time that's why i choose now()

soo sad but true .. it should get from local machine itself but don't know what went wrong.

i've select the correct time zone and still the same ..
is there any where that in the xampp set the time?

Did you restart the MySQL server after changing the time zone?

yes .. have stop and start back the mysql and apache

where you ever able to figure this out ctkam?

the sad thing is .. i couldn't figure out how to manage this issue yet

Have You checked all of these three statements?

SELECT CURRENT_TIMESTAMP
SELECT {fn NOW()}
SELECT GETDATE()
commented: good point out +3

If you are getting date wrong than you can hard code your date like this

SELECT GETDATE() + 1;

im still not sure of the solution but interested in learning it. not sure why i got a -1 rep on one of my posts here tho :|

why don't you try refreshing the apache so that the changes you made will take effect..?

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.