Check if its the birthday. Compares the date/month values of the two dates.

@param Date|null $dt The instance to compare with or null to use current day.

@return bool
541095
public function isBirthday(Date $dt = null)
    {
        $dt = $dt ?: static::now($this->getTimezone());

        return $this->format('md') === $dt->format('md');
    }
1314220
public static function isValideDate($year, $month, $day) {
        $dayLastMonthJalali = static::isLeapYear($year) && ($month == 12) ? 30 : static::$daysMonthJalali[intval($month)-1];
        return $year >= 1 && $year <= 32766
        && $month >= 1 && $month <= 12
        && $day >= 1 && $day <= $dayLastMonthJalali;
    }
343640
public function setDate($year, $month, $day)
	{
		if ($this->datetime->setDate($year, $month, $day))
		{
			return $this;
		}

		return false;
	}
912647
public function withDateAt(int $year = null, int $month = null, int $day = null) : self
    {
        if (null === $year && null === $month && null === $day) {
            return $this;
        }
        
        $year  = $year === null ? $this->year() : $year;
        $month = $month ?: $this->month();
        $day   = $day   ?: $this->day();
        
        $instance = clone $this;
        
        $instance->date->setDate($year, $month, $day);
        
        return $instance;
    }
1300689
public function average(Date $dt = null)
    {
        $dt = $dt ?: static::now($this->getTimezone());

        return $this->addSeconds((int) ($this->diffInSeconds($dt, false) / 2));
    }
34580
private static boolean checkDate(Calendar cal, Calendar other) {
		return checkDate(cal, other.get(Calendar.DATE), other.get(Calendar.MONTH));
	}
946999
private function matchesNearestWeekday($day, \DateTime $date)
    {
        $day = new \DateTime($date->format('F') . ' ' . substr($day, 0, -1) . ' ' . $date->format('Y'));
        $weekday = $day->format('w');

        if ($day->format('d') == $date->format('d') && $weekday !== '0' && $weekday !== '6') {
            return true;
        } elseif ($weekday == '0'
                  && $day->format('d') != $day->format('t')
                  && $this->getModifiedDateTime($day, 'next day')->format('d') == $date->format('d')
        ) {
            return true;
        } elseif ($weekday == '6'
                  && $day->format('d') != '1'
                  && $this->getModifiedDateTime($day, 'previous day')->format('d') == $date->format('d')
        ) {
            return true;
        }

        return false;
    }
196842
public final function setDay( int $day = null )
      : DateTime
   {

      if ( \is_null( $day ) )
      {
         $day = static::CurrentDay();
      }

      return $this->setDateParts( null, null, $day );

   }
998612
public static boolean isDate(String year, String month, String day) {
        // catch invalid years(not 2- or 4-digit) and invalid months and days.
        if (!(isYear(year) && isMonth(month) && isDay(day))) return false;

        int intYear = Integer.parseInt(year);
        int intMonth = Integer.parseInt(month);
        int intDay = Integer.parseInt(day);

        // catch invalid days, except for February
        if (intDay > daysInMonth[intMonth - 1]) return false;
        if ((intMonth == 2) && (intDay > daysInFebruary(intYear))) return false;
        return true;
    }
204006
static public function getBirthday($id)
    {
        if (empty($id) || strlen($id) !== 18)
            return null;

        $birthdayStr = substr($id, 6, 8);
        $year = substr($birthdayStr, 0, 4);
        $month = substr($birthdayStr, 4, 2);
        $day = substr($birthdayStr, 6, 2);

        return sprintf('%s-%s-%s', $year, $month, $day);
    }
888966
public static Date fromDateTime(final String dt) throws BadDateException {
    try {
      if (dt == null) {
        return null;
      }

      if (!dt.contains("-")) {
        return fromISODateTimeUTC(dt);
      }

      return fromRfcDateTimeUTC(dt);
    } catch (Throwable t) {
      throw new BadDateException();
    }
  }
257656
public static Date getRoundedDay(Date dt) {
        Calendar cal = new GregorianCalendar();
        cal.setTime(dt);
        return new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH))
                   .getTime();
    }
1133884
private function isSameDay(\DateTime $d1, \DateTime $d2)
    {
        return $d1->format('Y') == $d2->format('Y') && $d1->format('z') == $d2->format('z');
    }
921811
public function days($date = null)
	{
		return is_string($date) ? (new \DateTime($date, self::$utc))->diff($this->date)->days : $date->diff($this->date)->days;
	}
1091650
public function diffInHours(Date $dt = null, $abs = true)
    {
        return (int) ($this->diffInSeconds($dt, $abs) / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR);
    }
212389
private function isValidDate($date)
    {
        $date = str_replace('/', '-', $date);

        return (date_create($date)) ? JFactory::getDate($date)->format("Y-m-d") : null;
    }
900358
function validateDate($date = null)
    {
        if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) {
            return false;
        }

        if (!isset($date)) {
            $date = new DateTime($date, new DateTimeZone(@date_default_timezone_get()));
        }

        $notBefore = $this->currentCert['tbsCertificate']['validity']['notBefore'];
        $notBefore = isset($notBefore['generalTime']) ? $notBefore['generalTime'] : $notBefore['utcTime'];

        $notAfter = $this->currentCert['tbsCertificate']['validity']['notAfter'];
        $notAfter = isset($notAfter['generalTime']) ? $notAfter['generalTime'] : $notAfter['utcTime'];

        switch (true) {
            case $date < new DateTime($notBefore, new DateTimeZone(@date_default_timezone_get())):
            case $date > new DateTime($notAfter, new DateTimeZone(@date_default_timezone_get())):
                return false;
        }

        return true;
    }