Esempio n. 1
0
 function getShortDate($date, $format = array('d', 'b', 'y'), $locale = null)
 {
     assert('is_array($format)');
     assert('count($format) == 3');
     $date_order = fbDateTime::getDateOrder($locale);
     $rv = '';
     foreach ($date_order as $date_part) {
         if ($rv) {
             $rv .= ' ';
         }
         switch ($date_part) {
             case 'd':
                 $rv .= fbDateTime::strftime('%' . $format[0], $date);
                 break;
             case 'm':
                 $rv .= fbDateTime::strftime('%' . $format[1], $date);
                 break;
             case 'y':
                 $rv .= fbDateTime::strftime('%' . $format[2], $date);
                 break;
         }
     }
     return $rv;
 }
Esempio n. 2
0
 function test_strftime_20050103_VGY()
 {
     $fmt = '%V,%G,%Y';
     $date = '01/03/2005';
     $expected = '01,2005,2005';
     if (fbSystem::platform() == 'windows') {
         $expected = '1,2005,2005';
     }
     $rv = fbDateTime::strftime($fmt, strtotime($date));
     $fmt = str_replace($fmt, '%', '%%');
     $this->assertEquals($expected, $rv, "fmt='{$fmt}', date='{$date}'");
 }
Esempio n. 3
0
    if ($s !== false && $s != $char) {
        $supported .= $result;
    } else {
        $unsupported .= $result;
    }
}
echo "\ndate()\n\n";
echo "Supported\n\n";
echo $supported;
echo "\nUnsupported\n\n";
echo $unsupported;
$supported = '';
$unsupported = '';
$windows = '';
foreach ($formats as $char => $description) {
    $s = fbDateTime::strftime('%' . $char, $date);
    $result = sprintf("%3s: %-40s: %s\n", '%' . $char, "'" . $s . "'", $description);
    if ($s !== false && ($s != $char || $char == '%')) {
        if (strpos($char, '#') !== false) {
            $windows .= $result;
        } else {
            $supported .= $result;
        }
    } else {
        $unsupported .= $result;
    }
}
echo "\nfbLocale::strftime()\n\n";
echo "Supported\n\n";
echo $supported;
echo "\nUnsupported\n\n";