@param string $date

@return string 2016-09-20 (UTC+00:00)
762189
public static function date($date){

		$Date = static::_utcZeroDateTime($date);

		if($Date === null){

			return $date;
		}

		return $Date->format('Y-m-d');
	}
1195822
public static function get(UTCDateTime $date): DateTime
    {
        $date = $date->toDateTime();
        $date->setTimezone(new DateTimeZone(date_default_timezone_get()));

        return $date;
    }
1341257
public function parseDate($date)
    {
        $date = str_replace(['-', ':', '/', '.'], ' ', $date);
        $date_yyyy = $date_mm = $date_dd = $date_hh = $date_ii = $date_ss = 0;

        switch (sscanf($date, '%d %d %d %d %d %d', $date_yyyy, $date_mm, $date_dd, $date_hh, $date_ii, $date_ss)) {
            case 1:
                $date = sprintf('%04d/00/00 00:00:00', $date_yyyy);
                break;
            case 2:
                $date = sprintf('%04d/%02d/00 00:00:00', $date_yyyy, $date_mm);
                break;
            case 3:
                $date = sprintf('%04d/%02d/%02d 00:00:00', $date_yyyy, $date_mm, $date_dd);
                break;
            case 4:
                $date = sprintf('%04d/%02d/%02d %02d:00:00', $date_yyyy, $date_mm, $date_dd, $date_hh);
                break;
            case 5:
                $date = sprintf('%04d/%02d/%02d %02d:%02d:00', $date_yyyy, $date_mm, $date_dd, $date_hh, $date_ii);
                break;
            case 6:
                $date = sprintf('%04d/%02d/%02d %02d:%02d:%02d', $date_yyyy, $date_mm, $date_dd, $date_hh, $date_ii, $date_ss);
                break;
            default:
                $date = '0000/00/00 00:00:00';
        }

        return $date;
    }
26240
public function date_strtotime($date)
	{
		$strtotime = strtotime($date);
		if ($strtotime === -1 || $strtotime === false)
		{
			return false;
		}
		else
		{
			return $strtotime;
		}
	}
948416
public static function getTheMonth($date)
    {
        $firstDay = date('Y-m-01', strtotime($date));
        $lastDay = date('Y-m-d', strtotime("$firstDay +1 month -1 day"));

        return array($firstDay, $lastDay);
    }
1079042
public static function valid_date($date = null, $format = 'DD/MM/YYYY')
    {
        if ($date == null) {
            return false;
        }
        $lendate = strlen($date);
        if ($lendate > 10) {
            $date = substr($date, 0, 10);
            $lendate = strlen($date);
        }
        
        if ($lendate >= 8 && $lendate <= 10) {
            $regexp = $format;
            $regexp = str_replace('DD', '(?<D>\d{2})', $regexp);
            $regexp = str_replace('MM', '(?<M>\d{2})', $regexp);
            $regexp = str_replace('YYYY', '(?<Y>\d{4})', $regexp);
            
            if (preg_match("/$regexp/", $date, $aDate)) {
                $year = ($aDate['Y'] < 100) ? 2000 + $aDate['Y'] : $aDate['Y'];
                $month = $aDate['M'];
                $day = $aDate['D'];
                
                if (self::checkdate($month, $day, $year)) {
                    return mktime(0, 0, 0, $month, $day, $year);
                }
                else {
                    return false;
                }
            }
            else {
                return false;
            }
        }
        else {
            return false;
        }
    }
745845
function get_day_shortname($date="") {
  	if ($date=="") {
  		$date = $this->mdate();
 		}
		$dt = \DateTime::createFromFormat($this->dateFormat, $date);
		return $dt->format('D');
 	}
398457
public function diff($date = 'now')
	{
		if ($date instanceof static)
			return $this->date->diff($date->date);
		else if ($date instanceof \DateTime)
			return $this->date->diff($date);
		else if (is_string($date))
			return $this->date->diff(new \DateTime($date, self::$utc));
	//	return is_string($date) ? (new \DateTime($date, self::$utc))->diff($this->date)->days : $date->diff($this->date)->days;
	}
129906
public function max($date = null)
    {
        $date = $this->resolveCarbon($date);

        return $this->gt($date) ? $this : $date;
    }
165611
public static function getNextMonth($date)
    {
        $arr = getdate();

        if ($arr['mon'] === 12) {
            $year = $arr['year'] + 1;
            $month = $arr['mon'] - 11;
            $day = $arr['mday'];

            $mday = $day < 10 ? '0' . $day : $day;

            $firstDay = $year . '-0' . $month . '-01';
            $lastDay = $year . '-0' . $month . '-' . $mday;
        } else {
            $time = strtotime($date);
            $firstDay = date('Y-m-01', strtotime(date('Y', $time) . '-' . (date('m', $time) + 1) . '-01'));
            $lastDay = date('Y-m-d', strtotime("$firstDay +1 month -1 day"));
        }

        return [$firstDay, $lastDay];
    }
1041823
protected function toSql($date)
    {
        $tz = new DateTimeZone(JFactory::getApplication()->get('offset'));
        $date = new JDate($date);
        $date->setTimezone($tz);
        return $date->toSql(true);
    }
442891
public function formatDateTimeUtc(\DateTime $date = null)
    {
        if (null === $date) {
            return null;
        }

        $date->setTimezone(new \DateTimeZone('UTC'));

        return $date->format("Y-m-d\TH:i:s\Z");
    }
1169297
public function date($date=null)
    {
        if(is_null($date)) {
            $date = $this->created_at;
        }
        return String::date($date);
    }
1346450
public function textualDateFilter($date)
    {
        if ( ! $date instanceof \DateTime) {
            throw new \InvalidArgumentException('Textual Date Filter expects input to be a instance of DateTime');
        }

        $now  = new \DateTime('now');
        $diff = $now->diff($date);

        $diffUnit          = $this->getHighestDiffUnitAndValue($diff);
        $temporalModifier  = ($diff->invert)? 'ago':'next';
        $translationString = $temporalModifier. '.' .$diffUnit['unit'];

        // Override yesterday and tomorrow
        if ($diffUnit['unit'] == 'd' && $diffUnit['value'] == 1) {
            $translationString = ($diff->invert)? 'date.yesterday':'date.tomorrow';
        }

        // Override "just.now"
        if ($diffUnit['unit'] == 'now') {
            $translationString = 'date.just_now';
        }

        return $this->translator->transChoice($translationString, $diffUnit['value'], array('%value%' => $diffUnit['value']), 'date');
    }
709889
protected function valueToDateTime($date)
    {
        if (!$date instanceof \DateTime) {
            $date = is_int($date) ? \DateTime::createFromFormat('U', $date) : new \DateTime((string)$date);
        }
        
        return $date;
    }
620986
protected function sanitizeDateForIntl($date)
    {
        if (!($date instanceof DateTime)) {
            return $date;
        }
        if (version_compare(phpversion(), '5.3.4', '<')) {
            return $date->getTimestamp();
        }

        return $date;
    }
1095704
public function date($date, $format = null)
	{
		$datetime = DateTimeUtil::getDateTime($date);
        if (empty($format)) {
			$format = $this->cfg['date_format'];
		}
		if ($format == 'rel') {
			$date = DateTimeUtil::getRelTime($datetime);
		} else {
			$date = $datetime->format($format);
		}
		return $date;
	}