Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between MySQL NOW() and PHP date('c')

Tags:

date

php

time

mysql

What is the difference between them? If I use them both on my local machine (windows, xampp), the difference between them is one hour. Why?

like image 306
Badr Hari Avatar asked Dec 30 '25 01:12

Badr Hari


2 Answers

You are probably having different timezone for PHP and MySql. You need to set the same timezone for both to get the date time without any difference

like image 52
Shakti Singh Avatar answered Dec 31 '25 14:12

Shakti Singh


there's no difference, but you might have configured different timezones for both (or one of them doesn't use daylight saving time). please check your...

  • php configuration
  • mysql configuration
like image 35
oezi Avatar answered Dec 31 '25 16:12

oezi