Yahoo Poland Wyszukiwanie w Internecie

Search results

  1. 25 wrz 2010 · To convert the UTC date to the server (local) time, you can use DateTime without the second argument, which defaults to the server timezone. // create a $dt object with the UTC timezone. $dt = new DateTime('2016-12-12 12:12:12', new DateTimeZone('UTC')); // get the local timezone.

  2. 15 cze 2010 · Let's try a solution that uses PHP's modern date handling. This example requires PHP 5.2 or better. // Right now it's about four minutes before 1 PM, PST. $pst = new DateTimeZone('America/Los_Angeles'); $three_hours_ago = new DateTime('-3 hours', $pst); // first argument uses strtotime parsing.

  3. 9 sty 2024 · A timestamp in PHP is the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) and is used to store or transfer date-time data in a compact form. PHP provides built-in functions for converting a timestamp to a date-time string and vice versa, which we will explore in this guide.

  4. 25 mar 2023 · The Date and Time time zone can be easily converted from a specific time zone to another time zone using the PHP's built-in classes or objects called DateTime and DateTimeZone. These 2 PHP classes can be used to set the specific date and time into a certain Time Zone and generate the different time zone offset values.

  5. 14 mar 2023 · In this example, we’re converting a date and time to the Eastern Timezone, which is five hours behind Coordinated Universal Time (UTC). We’re first using strtotime() to convert the string representation of the date and time to a Unix timestamp.

  6. 15 lut 2016 · if($tz === null) $tz = date_default_timezone_get(); $dtz = new DateTimeZone('UTC'); $dt = new DateTime($dts, $dtz); $dt->setTimezone(new DateTimeZone($tz)); return $dt->format($format); This method supports a default datetime format and will default the timezone to the currently configured timezone.

  7. Example of converting between timezones using the DateTime and DateTimeZone classes. Note that PHP will also take care of calculating relevant daylight savings! <?php $utc_timezone = new DateTimeZone ("UTC"); $tallinn_timezone = new DateTimeZone ("Europe/Tallinn"); // Create a new DateTime object in the UTC format

  1. Ludzie szukają również