Skip to content

Instantly share code, notes, and snippets.

@kylekatarnls
Created January 28, 2019 14:23
Show Gist options
  • Save kylekatarnls/ee07c2fd8ec871c092db6f87d2a6b324 to your computer and use it in GitHub Desktop.
Save kylekatarnls/ee07c2fd8ec871c092db6f87d2a6b324 to your computer and use it in GitHub Desktop.
<?php
setlocale(LC_TIME, "$lang.UTF-8", "$lang.utf8", $lang, strstr($lang, '_', true));
$utcString = '2018-05-12 23:16:46.123456';
$date = new DateTimeImmutable($utcString);
$localString = $date->setTimezone(new DateTimeZone($timezone))->format('Y-m-d H:i:s.u');
echo strftime('%x %X', strtotime($localString));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment