Ejemplo n.º 1
0
 public function viewDate($date)
 {
     date_default_timezone_set('UTC');
     $formater = new CDateFormatter(Yii::app()->locale);
     $hour = intval($formater->format('H', $date));
     $min = intval($formater->format('mm', $date));
     $sec = intval($formater->format('ss', $date));
     $month = intval($formater->format('M', $date));
     $day = intval($formater->format('d', $date));
     $year = intval($formater->format('yyyy', $date));
     return mktime($hour, $min, $sec, $month, $day, $year) * 1000;
 }
Ejemplo n.º 2
0
function date2longperiode($date, $format)
{
    $timestamp = CDateTimeParser::parse($date, 'yyyy-MM-dd');
    $formater = new CDateFormatter('id_ID');
    return $formater->format($format, $timestamp);
}
Ejemplo n.º 3
0
<?php

if ($this->beginCache('good-review-' . $review->id, array('duration' => 3600))) {
    ?>

<?php 
    $timestamp = CDateTimeParser::parse($review->date, 'yyyy-MM-dd');
    $dateFormatter = new CDateFormatter('ru');
    $date = $dateFormatter->format('d MMMM yyyy', $timestamp);
    $user = $review->user->username;
    ?>
<div class="b-grade comment left0">
		<div class="data">
			<div class="grade-title">
				<div class="user">
					<span class="b-user"><b class="b-user"><?php 
    echo $user;
    ?>
</b></span>&nbsp;
				</div>
				<div class="date"><?php 
    echo $date;
    ?>
</div>
				<div class="clearfix"></div>
			</div>
			<div class="b-lr-container">
				<div class="grade left">
				<?php 
    $r = $review->rating;
    echo '<div class="x-rating x-rate-' . round($r * 4) . '"></div>';
Ejemplo n.º 4
0
 public static function getFirstDayYear()
 {
     $cDateFormatter = new CDateFormatter(Yii::app()->language);
     $dayOfYear = $cDateFormatter->format("D", date('Y-m-d'));
     return date('Y-m-d', strtotime(date("Y-m-d") . " -" . $dayOfYear . "day"));
 }
Ejemplo n.º 5
0
 public function dbDate()
 {
     $formater = new CDateFormatter(Yii::app()->locale);
     $this->date = $formater->format('yyyy-MM-dd HH:mm:ss', $this->date);
 }
Ejemplo n.º 6
0
 public static function getDateFormatted($dateToFormat, $locale = null, $formatter = null)
 {
     if (strlen($dateToFormat) == 0) {
         return "";
     }
     if ($locale == null) {
         $locale = CLocale::getInstance('en');
     }
     if ($locale == null) {
         $locale = CLocale::getInstance();
     }
     if ($formatter == null) {
         $formatter = new CDateFormatter($locale);
     }
     // var_dump($locale);
     // var_dump($formatter);
     return $formatter->format(User::getDateFormat($locale), $dateToFormat);
 }