Skip to content

Instantly share code, notes, and snippets.

@superjojo140
Last active October 23, 2022 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save superjojo140/2d4427b37205397dc7c03bcac7d7bcee to your computer and use it in GitHub Desktop.
Save superjojo140/2d4427b37205397dc7c03bcac7d7bcee to your computer and use it in GitHub Desktop.
Print UTC datetime-string as locale date in PHP
<?php
$inputUtc = "2022-10-23T10:00:00";
$dateObject = date_create($inputUtc,timezone_open("UTC"));
print_r($dateObject);
$timestamp = date_timestamp_get($dateObject);
date_default_timezone_set("Europe/Berlin");
echo date("d.m.Y H:i",$timestamp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment