Easy Way to Convert UTC to Current Timezone in PHP

January 13, 2009 – 8:59 am


$utc_time = "2009-01-12 21:28:21"; // As pulled from the database
date_default_timezone_set("America/New_York"); // Set to Eastern time (automatically handles daylight savings time)

// Here's the secret: add a Z (for zulu) to the end of your UTC date/time string
$utc_time .= "Z";

// Now convert to the current timezone
$cur_date = strftime("%G-%m-%d %H:%M:%S", strtotime($utc_time)); // Format as YYYY-MM-DD HH:MM:SS


The result: 2009-01-12 16:28:21

How do you handle this? Let me know in the comments.

Share and Enjoy:
  • Twitter
  • Facebook
  • Digg
  • Reddit
  • del.icio.us
  • Google Bookmarks
  • LinkedIn
  • StumbleUpon
  • email
  • Print

No related posts.

  1. 2 Responses to “Easy Way to Convert UTC to Current Timezone in PHP”

  2. I just let my coworkers figure it out :P

    By Mark UNITED STATES Mac OS X Mozilla Firefox 3.1b2 on Jan 13, 2009

  3. What’s new? ;)

    By Jeremy UNITED STATES PHP on Jan 13, 2009

Post a Comment