Skip to content

Instantly share code, notes, and snippets.

@cafuego
Created September 18, 2012 02:39
Show Gist options
  • Save cafuego/3740954 to your computer and use it in GitHub Desktop.
Save cafuego/3740954 to your computer and use it in GitHub Desktop.
#!/usr/bin/php
<?php
// define('FORMAT', 'jS F Y');
// define('FORMAT', 'YYYY/mm/dd MMM M m mmm ddd j S EEEE');
define('FORMAT', 'dd');
define('LOCALE', 'nl_NL.UTF-8');
$alpha = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z');
/**
* a = AM/PM
* ccc = do
* cccc = donderdag
* d = 23
*
*/
foreach($alpha as $c) {
$format = '';
for ($i = 0; $i <= 3; $i++) {
$format .= $c;
$old = date_format(new DateTime(), $format);
$d = new IntlDateFormatter(
LOCALE,
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
date_default_timezone_get(),
IntlDateFormatter::TRADITIONAL,
$format);
$new = $d->format(time());
echo (($old != $new) ? "-- " : " ") . $format . "\t= " . $old . "\n";
echo (($old != $new) ? "++ " : " ") . $format . "\t= " . $new . "\n";
$furmat = strtoupper($format);
$old = date_format(new DateTime(), $furmat);
$d = new IntlDateFormatter(
LOCALE,
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
date_default_timezone_get(),
IntlDateFormatter::TRADITIONAL,
$furmat);
$new = $d->format(time());
echo (($old != $new) ? "-- " : " ") . $furmat . "\t= " . $old . "\n";
echo (($old != $new) ? "++ " : " ") . $furmat . "\t= " . $new . "\n";
}
}
die();
require_once('date_patch.inc');
if (!empty($_SERVER['argv'][1])) {
setlocale(LC_ALL, $_SERVER['argv'][1]);
}
print date('jS F Y');
$date_time = date_create('@' . time());
print date_format($date_time, 'jS F Y m W', 'nl_NL.UTF-8');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment