Guest User

Untitled

a guest
Jan 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Date is for manipulations with date
  5.  *
  6.  * @author Olga Gramovich
  7.  */
  8. class Application_Model_Utils_Date {
  9.     static $MONTHES = array('12' => "Декабрь", '01' => 'Январь', '02' => 'Февраль', '03' => 'Март',
  10.         '04' => 'Апрель', '05' => 'Май', '06' => 'Июнь', '07' => 'Июль', '08' => 'Август',
  11.         '09' => 'Сентябрь', '10' => 'Октябрь', '11' => 'Ноябрь');
  12.     static $WEEK_SHORT = array('1' => 'Пн', '2' => 'Вт', '3' => 'Ср',
  13.         '4' => 'Чт', '5' => 'Пт', '6' => 'Сб', '0' => 'Вс');
  14.  
  15.     public static function getMonth($month) {
  16.        return Application_Model_Utils_Date::$MONTHES[$month];
  17.     }
  18.     public static function getPreviousMonth($year, $month) {
  19.         return date("m", mktime(0, 0, 0, $month - 1, 1, $year));
  20.     }
  21.  
  22.     public static function getNextMonth($year, $month) {
  23.         return date("m", mktime(0, 0, 0, $month + 1, 1, $year));
  24.     }
  25.  
  26.     public static function getPreviousYear($year, $month) {
  27.         return date("Y", mktime(0, 0, 0, $month - 1, 1, $year));
  28.     }
  29.  
  30.     public static function getNextYear($year, $month) {
  31.         return date("Y", mktime(0, 0, 0, $month + 1, 1, $year));
  32.     }
  33.  
  34. }
  35. ?>
Add Comment
Please, Sign In to add comment