Timezones and timestamp SQL to PHP

Dealing with godaddy mySQL timestamps on a shared server. As of this posting, although Arizona is in the Mountain time zone, it does not participate in the Daylight Savings party. Issue is that godaddy timstamps are “readable” but are in US/Arizona timezone. If the server is on a shared host, the default timezone can NOT be changed.

Here is my solution to the problem of querying a godaddy sql server timestamp:

  1. In your PHP script include the line (add your desired time zone as needed):
    date_default_timezone_set(‘America/New_York’);
  2. In the $sql “SELECT….” statement, use the following:
    UNIX_TIMESTAMP(timestamp);
  3. To display the time in a readable format use “date(‘format’,timestamp)” formula:
    echo date(‘D, M j – g:ia’,timestamp);