/**
  *  This function returns the year day of the date.
  *
  *  @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 year day.
  *
  *  @static   If $date is passed.
  */
 function getYearDay($date = null, $format = "ISO")
 {
     if ($date === null) {
         $date = $this->parse($date, $format);
     } else {
         $date = YDDate::parse($date, $format);
     }
     $yday = 0;
     for ($i = 1; $i < $date['month']; $i++) {
         $yday += YDDate::getDaysInMonth($i, $date['year']);
     }
     return $yday + $date['day'];
 }
 /**
  *  This function returns the quarter of the date.
  *
  *  @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 quarter.
  *
  *  @static   If $date is passed.
  */
 function getQuarter($date = null, $format = 'ISO')
 {
     if ($date === null) {
         $date = $this->parse($date, $format);
     } else {
         $date = YDDate::parse($date, $format);
     }
     switch ($date['month']) {
         case 1:
         case 2:
         case 3:
             return 1;
         case 4:
         case 5:
         case 6:
             return 2;
         case 7:
         case 8:
         case 9:
             return 3;
         case 10:
         case 11:
         case 12:
             return 4;
     }
     return 0;
 }