Skip to content

Instantly share code, notes, and snippets.

@drmalex07
Created March 16, 2014 22:34
Show Gist options
  • Save drmalex07/9590831 to your computer and use it in GitHub Desktop.
Save drmalex07/9590831 to your computer and use it in GitHub Desktop.
An example for a localized formatted date in PHP. #php #datetime #i18n
<?php
$expected_duration = new DateInterval("PT03H30M"); /* 03:30:00 or 3h 30min */
$expected_at = new DateTime('now');
$expected_at->add($expected_duration);
$formatter = new IntlDateFormatter('el_GR', IntlDateFormatter::LONG, IntlDateFormatter::SHORT);
print $formatter->format($expected_at);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment