Exemplo n.º 1
0
 /**
  *  This function returns the weekday name.
  *
  *  @param $abbr   (Optional) If true, returns the abbreviated weekday name. Default: false.
  *  @param $date   (Optional) A YDDate object, timestamp, array or string.
  *                            If null, the date of the object. Default: null.
  *  @param $format (Optional) The format name. Default: 'ISO'.
  *  
  *  @returns  The weekday name.
  *
  *  @static   If $date is passed.
  */
 function getDayName($abbr = false, $date = null, $format = 'ISO')
 {
     if ($date === null) {
         $weekday = $this->getWeekDay($date, $format);
     } else {
         $weekday = YDDate::getWeekDay($date, $format);
     }
     for ($i = 1; $i <= 7; $i++) {
         $wday = strftime('%w', mktime(0, 0, 0, 1, $i, 2000));
         if ($wday == $weekday) {
             if ($abbr) {
                 return ucfirst(strftime('%a', mktime(0, 0, 0, 1, $i, 2000)));
             }
             return ucfirst(strftime('%A', mktime(0, 0, 0, 1, $i, 2000)));
         }
     }
     return '';
 }