-
-
Save lsolesen/411656 to your computer and use it in GitHub Desktop.
Using intl pecl extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// using the intl pecl extension | |
$datefmt = new IntlDateFormatter("da-DK", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, date_default_timezone_get()); | |
$danish = '2010-10-10 10:10:10'; | |
$formatted = $datefmt->format(strtotime($danish)); // 10/10/10 10.10 | |
echo $parsed = $datefmt->parse($formatted); // 1286698200 | |
$fmt = new NumberFormatter( 'da_DK', NumberFormatter::DECIMAL ); | |
$num = "1234.567,891"; | |
$parsed_number = $fmt->parse($num); // 1234567.891 | |
$fmt->format($parsed_number); // 1.234.567,891 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment