How to Convert UTC to Pacific Time in PHP

104 17
    • 1). Open your PHP application in the PHP editor of your choice.

    • 2). Type out the UTC date you want to convert and set it to a variable:

      $utcTime = "2012-01-01 05:04:59";

    • 3). Type, on a new line, the calculation function and set it equal to a new variable:

      $pstTime = $utcTime - 28800;

      This subtracts 8 hours worth of seconds from the UTC time and, since PST is UTC-8, your time is converted from UTC to Pacific time.

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.