Example #1
0
 /**
  * Support all JevDate::strftime() parameter for Window systems
  *
  * @param string $format
  * @param int $timestamp
  * @return string formated string
  */
 function jev_strftime($format = '', $timestamp = null)
 {
     if (!$timestamp) {
         $timestamp = time();
     }
     // Replace names by own translation to get rid of improper os system library
     if (strpos($format, '%a') !== false) {
         $format = str_replace('%a', JEVHelper::getShortDayName(date('w', $timestamp)), $format);
     }
     if (strpos($format, '%A') !== false) {
         $format = str_replace('%A', JEVHelper::getDayName(date('w', $timestamp)), $format);
     }
     if (strpos($format, '%b') !== false) {
         $format = str_replace('%b', JEVHelper::getShortMonthName(date('n', $timestamp)), $format);
     }
     if (strpos($format, '%B') !== false) {
         $format = str_replace('%B', JEVHelper::getMonthName(date('n', $timestamp)), $format);
     }
     if (JUtility::isWinOS()) {
         if (!class_exists('JEV_CompatWin')) {
             require_once dirname(__FILE__) . '/compatwin.php';
         }
         return JEV_CompatWin::win_strftime($format, $timestamp);
     } else {
         return JevDate::strftime($format, $timestamp);
     }
 }
 /**
  * Get week number according ISO 8601
  *
  * @static
  * @param int $date date
  * @return int weeknumber
  */
 function _getWeekNumberISO8601($date)
 {
     $thursday = JEV_CompatWin::_getThursdayOfWeek($date);
     $thursday_Y = JevDate::strftime('%Y', $thursday);
     $first_th = JEV_CompatWin::_getThursdayOfWeek(JevDate::strtotime($thursday_Y . '-01-04'));
     return (JevDate::strftime('%j', $thursday) - JevDate::strftime('%j', $first_th)) / 7 + 1;
 }