Get the usage case by comparing two dates.
@return string
340763
private function getDateCase()
    {
        $from = $this->from;
        $to = $this->to;

        // single date event
        if (!$to || $to->format('Ymd') === $from->format('Ymd')) {
            return 'single';
        }

        $fromDate = [
            'day'   => $from->format('d'),
            'month' => $from->format('m'),
            'year'  => $from->format('y')
        ];

        $toDate = [
            'day'   => $to->format('d'),
            'month' => $to->format('m'),
            'year'  => $to->format('y')
        ];

        $case = null;
        $case = $fromDate['day'] !== $toDate['day'] ? 'different_day' : $case;
        $case = $fromDate['month'] !== $toDate['month'] ? 'different_month' : $case;
        $case = $fromDate['year'] !== $toDate['year'] ? 'different_year' : $case;

        return $case;
    }
588615
public function getCallable()
    {
        return function ($format, $timestamp = null) {
            if (is_null($timestamp)) {
                $timestamp = $this->timestamp;
            }
            return \date($format, $timestamp);
        };
    }
454715
function getDateTimeExpiration()
    {
        if (! $this->datetimeExpiration ) {
            if ($this->expiresIn) {
                // Maybe not include this field
                $exprDateTime = __( new \DateTime() )
                    ->add( new \DateInterval(sprintf('PT%sS', $this->expiresIn)) );

                $this->datetimeExpiration = $exprDateTime;
            }

        }


        return $this->datetimeExpiration;
    }
210865
public static function ruleDateTime()
    {
        return function ($input) {
            $date = null;
            try {
                $date = date_parse($input);
                return $date['warning_count'] === 0 && $date['error_count'] === 0;
            }
            catch(\Exception $e) {
                return false;
            }
        };
    }
207192
public function getDateFormat()
	{
		$date = strftime("%x", mktime(0, 0, 0, 1, 31, 2009));
		if (preg_match("/31[- \/.]0?1[- \/.](20)?09/", $date))
		{
			return DATEFORMAT::DMY;
		}
		elseif (preg_match("/0?1[- \/.]31[- \/.](20)?09/", $date))
		{
			return DATEFORMAT::MDY;
		}
		else
		{
			return DATEFORMAT::YMD;
		}
	}
37240
public static function ruleDate()
    {
        return function ($input) {
            $date = null;
            try {
                $date = date_parse($input);
                if ($date['warning_count'] === 0 && $date['error_count'] === 0) {
                    return strlen($date['hour']) === 0;
                }
                else {
                    return false;
                }
            }
            catch(\Exception $e) {
                return false;
            }
        };
    }
1125566
public function getDefaultMonth()
    {
        $result = null;

        $keys = array_keys($this->getMonths());
        if (count($keys) >= 2) {
            $result = (string)$keys[1];
        }

        return $result;
    }
1333869
public function check()
    {
        $cutoffTime =  strtotime($this->relativeAge, DBDatetime::now()->Format('U'));
        $files = $this->getFiles();
        $invalidFiles = [];
        $validFiles = [];
        $checkFn = $this->checkFn;
        $allValid = true;
        if ($files) {
            foreach ($files as $file) {
                $fileTime = $checkFn($file);
                $valid = ($this->compareOperand == '>') ? ($fileTime >= $cutoffTime) : ($fileTime <= $cutoffTime);
                if ($valid) {
                    $validFiles[] = $file;
                } else {
                    $invalidFiles[] = $file;
                    if ($this->checkType == self::CHECK_ALL) {
                        return [
                            EnvironmentCheck::ERROR,
                            sprintf(
                                'File "%s" doesn\'t match age check (compare %s: %s, actual: %s)',
                                $file,
                                $this->compareOperand,
                                date('c', $cutoffTime),
                                date('c', $fileTime)
                            )
                        ];
                    }
                }
            }
        }

        // If at least one file was valid, count as passed
        if ($this->checkType == self::CHECK_SINGLE && count($invalidFiles) < count($files)) {
            return [EnvironmentCheck::OK, ''];
        }
        if (count($invalidFiles) == 0) {
            return [EnvironmentCheck::OK, ''];
        }
        return [
            EnvironmentCheck::ERROR,
            sprintf('No files matched criteria (%s %s)', $this->compareOperand, date('c', $cutoffTime))
        ];
    }
337812
public function getUsedAt()
    {
        @trigger_error(
            'The '.__METHOD__
            .' method is deprecated since version 2.2 and will be removed in 3.0. Use the getLastUsage() method instead.',
            E_USER_DEPRECATED
        );

        $usage = $this->getLastUsage();
        if (null === $usage) {
            return null;
        }

        return $usage->getCreatedAt();
    }
436041
public function getDateActive() : ?DateTime
     {
        $rtn = $this->data['date_active'];

        if (!empty($rtn)) {
            $rtn = new DateTime($rtn);
        }

        return $rtn;
     }
662798
public function getRangeString()
    {
        $dateStart = $this->getDateStart();
        $dateEnd   = $this->getDateEnd();

        return $dateStart->toString("Y-m-d") . "," . $dateEnd->toString("Y-m-d");
    }
280559
public function getBadPasswordDate()
    {
        if ($timestamp = $this->getBadPasswordTimestamp()) {
            return (new DateTime())->setTimestamp($timestamp)->format($this->dateFormat);
        }
    }
1273924
public function getUsage()
    {
        $str_prog = basename($_SERVER['argv'][0]);

        $label_usage = 'Usage:';

        if ($this->obj_color->label || $this->obj_color->bold) {
            $label_usage = new Ansi($label_usage);

            if ($this->obj_color->label) {
                $label_usage->fg($this->obj_color->label);
            }

            if ($this->obj_color->bold) {
                $label_usage->bold;
            }
        }

        $first = new S(sprintf('%s %s %s', $label_usage, $str_prog, "[OPTIONS]…"));

        $arr_out = array(
            $first->wrap(OptionItem::getWidth() - 7)->margin(7, 0, -7)
        );

        foreach ($this->arr_usage as $item) {
            $item = new S($str_prog.' '.$item);
            $arr_out[] = $item->wrap(OptionItem::getWidth() - 7)->margin(7);
        }

        return implode(PHP_EOL, $arr_out);
    }
216451
public function getDateRange()
    {
        $fields = $this->getFields();
        if (!empty($this->start) && empty($this->end)) {
            return 'since ' . $fields['start']->formattedValue;
        } elseif (empty($this->start) && !empty($this->end)) {
            return 'until ' . $fields['end']->formattedValue;
        } else {
            return implode(' – ', [$fields['start']->formattedValue, $fields['end']->formattedValue]);
        }
    }
837524
public function usage()
    {
        $name = (strlen($this->_short) > 0) ? ('-' . $this->_short) : ('--' . $this->_name);
        $default = '';
        if (strlen($this->_default) > 0 && $this->_default !== true) {
            $default = ' ' . $this->_default;
        }
        if ($this->_choices) {
            $default = ' ' . implode('|', $this->_choices);
        }

        return sprintf('[%s%s]', $name, $default);
    }
1333549
public function getDatePrettyPrint()
  {
    $date = str_replace('?', '', $this->date);
    $date = explode('.', $date);
    $date = array_filter($date);

    if (count($date) == 2 || count($date) == 3) {
      $month = date('F', mktime(0, 0, 0, $date[1], 1));
      $date = "$month, $date[0]";
    } elseif (count($date) == 1) {
      $date = $date[0];
    } else {
      $date = null;
    }

    return $date;
  }
960154
public function getOrderDate()
    {
        if ( empty( $this->oxorder__oxorderdate->value ) ) {
            return '';
        }

        return date( 'Y-m-d', strtotime( $this->oxorder__oxorderdate->value ) );
    }