示例#1
0
<?php

require 'vendor/autoload.php';
use Kbirmhrjn\Date\Date;
// Set the language
setlocale(LC_ALL, $argv[1] ?: 'en');
$months = array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december');
$days = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
$translations = array();
foreach ($months as $month) {
    $date = new Date($month);
    $translation = strftime('%B', $date->getTimestamp());
    $translations[$month] = $translation;
    echo "'" . $month . "'\t=> '" . $translation . "',\n";
}
echo "\n";
foreach ($days as $day) {
    $date = new Date($day);
    $translation = strftime('%A', $date->getTimestamp());
    $translations[$day] = $translation;
    echo "'" . $day . "'\t=> '" . $translation . "',\n";
}
示例#2
0
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $locale = $this->app['translator']->getLocale();
     Date::setLocale($locale);
 }