0

I am changing int(11) in a mysql database back into regular date formats (mm/dd/yyy) It is working fine except it appears to be one day behind. Any ideas on what could be causing this?

The code I am using to change it from int(11) to mm/dd/yyy is below: (yes it is part of a larger script, this is just the one line that includes the date.)

echo "<td>" . date('m/d/Y', $row['due_date']) . "</td>";

Wihout the td's:

echo date('m/d/Y', $row['due_date]);

In my particular testing it should be returning: 07/01/2013 and it is returning: 06/30/2013

user2371301
  • 3,294
  • 4
  • 18
  • 26

1 Answers1

2

How is the table getting populated? You need to check the server timezone and then while displaying it in date format add those number of hours and that should fix your problem.

e.g if the source is GMT and you are expecting dates to be in sync with PST, then you need to add/subtract couple of hours.

i.e

echo date('m/d/Y', $row['due_date]+$offset_in_seconds);
mishka
  • 677
  • 6
  • 20