Returns true if given datetime string is not now AND is in the future.

@param string $dateString Datetime string or Unix timestamp
@param int|null $timezone User's timezone
@return bool True if datetime is not today AND is in the future
966076
public static function isInTheFuture($dateString, $timezone = null) {
		$date = new CakeTime($dateString, $timezone);
		$date = $date->format('U');
		return date(FORMAT_DB_DATETIME, $date) > date(FORMAT_DB_DATETIME, time());
	}
777980
public static DateTime parseTime(String timeString) {
		timeString = normalize(timeString);
		return parse(timeString, DatePattern.NORM_TIME_FORMAT);
	}
708396
public function toRss($dateString, $timezone = null)
    {
        $timezone = $this->_getTimezone($timezone) ?: date_default_timezone_get();

        return (new Time($dateString))->timezone($timezone)->toRssString();
    }
858142
private static function _timestampToUTC($timestamp)
    {
        $tz = new DateTimeZone('UTC');
        $dateTime = new DateTime($timestamp, $tz);
        $dateTime->setTimezone($tz);
        return $dateTime;
    }
626832
function _date2timestamp( $datetime, $tz=null ) {
    $output = null;
    if( !isset( $datetime['hour'] )) $datetime['hour'] = '0';
    if( !isset( $datetime['min'] ))  $datetime['min']  = '0';
    if( !isset( $datetime['sec'] ))  $datetime['sec']  = '0';
    foreach( $datetime as $dkey => $dvalue ) {
      if( 'tz' != $dkey )
        $datetime[$dkey] = (integer) $dvalue;
    }
    if( $tz )
      $datetime['tz'] = $tz;
    $offset = 0;
    if( isset( $datetime['tz'] ) && ( '' < trim ( $datetime['tz'] )))
      $offset = $this->_tz2offset( $datetime['tz'] );
    $output          = mktime( $datetime['hour']
                             , $datetime['min']
                             , $datetime['sec'] + $offset
                             , $datetime['month']
                             , $datetime['day']
                             , $datetime['year'] );
    return $output;
  }
1342045
public static function parseDateRange($dateString)
    {
        $matched = preg_match('/^([0-9]{4}-[0-9]{1,2}-[0-9]{1,2}),(([0-9]{4}-[0-9]{1,2}-[0-9]{1,2})|today|now|yesterday)$/D', trim($dateString), $regs);

        if (empty($matched)) {
            return false;
        }

        return $regs;
    }
516003
public static DateTime parseDate(String dateString) {
		dateString = normalize(dateString);
		return parse(dateString, DatePattern.NORM_DATE_FORMAT);
	}
1276112
public static function isValidTimezone($timezone) {
		static $cache;
		if (!is_array($cache)) {
			$cache = array();
		}
		
		if (isset($cache[$timezone])) {
			return $cache[$timezone];
		}
		
		$cache[$timezone] = in_array($timezone, DateTimeZone::listIdentifiers());
		return $cache[$timezone];
	}
180155
public static function isTimestamp($timestamp)
    {
        if (is_bool($timestamp) || !is_scalar($timestamp)) {
            return false;
        }
        return ((string)(int)$timestamp === (string)$timestamp)
        && ($timestamp <= PHP_INT_MAX)
        && ($timestamp >= ~PHP_INT_MAX);
    }
959176
public static function today($timeZone = null)
    {
        $now = null;
        $before = null;
        if ( is_null($timeZone) ) {
            $now = new \DateTime();
            $before = new \DateTime();
        } else {
            $now = new \DateTime( "now", new \DateTimeZone( $timeZone ) );
            $before = new \DateTime( "now", new \DateTimeZone( $timeZone ) );
        }
        $range = new Range( $before, $now );

        return $range;
    }
669458
public static function string2dateTime($string, \DateTimeZone $zone = null)
    {
        if (!$zone) {
            $zone = new \DateTimeZone('UTC');
        }

        $dt = new \DateTime('now', $zone);
        $dt->setTimestamp(self::string2timestamp($string));

        return $dt;
    }
1097619
private function checkDateString($dateTimeString)
    {
        if (empty($dateTimeString)) {
            return null;
        }

        try {
            $date = new \DateTime($dateTimeString);
        } catch (Exception $e) {
            return null;
        }

        return $date;
    }
573666
private function isBetween($timestamp, $fromTime, $toTime, $format = 'Hi')
    {
        $dateTime = new DateTime();
        $timezone = new DateTimeZone('UTC');
        $dtRef = $dateTime->createFromFormat('U', $timestamp, $timezone);
        $dtFrom = $dateTime->createFromFormat($format, $fromTime, $timezone);
        $dtTo = $dateTime->createFromFormat($format, $toTime, $timezone);
        if ($dtFrom > $dtTo) {
            $dtTo->modify('+1 day');
        }
        return (
                $dtFrom <= $dtRef &&
                $dtRef <= $dtTo
            ) || (
                $dtFrom <= $dtRef->modify('+1 day') &&
                $dtRef <= $dtTo
            );
    }
1225469
public function setThaiYear(DateTime $timestamp){
        if($this->checkThaiLocale()){
            return $timestamp->setDate(($timestamp->format('Y')+543),$timestamp->format('m'),$timestamp->format('d'));
        }else{
            return $timestamp;
        }
    }
382545
public static function fromFormat(string $format, string $dateString) : DateTime
    {
        return new self(\DateTimeImmutable::createFromFormat('!' . $format, $dateString));
    }
199243
public static function verifyDateTime(string $datetime, string $format): bool
    {
        $formatted = DateTime::createFromFormat($format, $datetime);

        $errors = DateTime::getLastErrors();

        if (!empty($errors['warning_count'])) {
            return false;
        }

        return $formatted !== false;
    }
671115
public function localDateMarkup($dateString = null, $format = null, $options = []) {
		$date = $this->localDate($dateString, $format, $options);
		$date = '<span' . ($this->isToday($dateString, (isset($options['userOffset']) ? $options['userOffset'] : null)) ? ' class="today"' : '') . '>' . $date . '</span>';
		return $date;
	}