Display published_at datetime
@param null $format
@param null $timezone
@return bool|string
769295
public function getPublishedAt($format = null, $timezone = null)
    {
        return $this->getDisplayDateTime($this->published_at, $format, $timezone);
    }
469793
public function Format($format)
    {
        if (!$this->value) {
            return null;
        }
        $formatter = $this->getFormatter();
        $formatter->setPattern($format);
        return $formatter->format($this->getTimestamp());
    }
409474
public function format($datetime, $pattern, $locale = null, $timezone = null)
    {
        $date = $this->getDatetime($datetime, $timezone);

        $formatter = self::createInstance([
            'locale' => $locale ?: $this->localeDetector->getLocale(),
            'datetype' => \IntlDateFormatter::FULL,
            'timetype' => \IntlDateFormatter::FULL,
            'timezone' => $timezone ?: $this->timezoneDetector->getTimezone(),
            'calendar' => \IntlDateFormatter::GREGORIAN,
            'pattern' => $pattern,
        ]);

        return $this->process($formatter, $date);
    }
616618
public function getUpdatedAt($format = null, $timezone = null)
    {
        return $this->getDisplayDateTime($this->updated_at, $format, $timezone);
    }
92525
public function getAsDate($column, $format = null, $default = false)
  {
    $v = $this->get($column, $default);

    return $v ? new DateTime($v, null, $format) : $default;
  }
717796
public function format($format = 'date', $timestamp = null)
    {
        $timestamp = is_numeric($timestamp) ? '@'.intval($timestamp) : $timestamp;
        $timestamp = is_a($timestamp, 'DateTime') ? $timestamp : new DateTime($timestamp);

        $key = $this->getTranslationKey("date.formats.{$format}");
        $format = $this->translator->has($key) ? $this->translator->get($key) : null;

        if (is_null($format)) {
            throw new \InvalidArgumentException('Date format is invalid or does not exists in current language');
        }

        return strftime($format, $timestamp->format('U'));
    }
1174726
public static function formatOrNull($dateTime, $format = 'Y-m-d H:i:s', $null = null)
    {
        if ($dateTime instanceof \DateTime) {
            return $dateTime->format($format);
        } elseif (ValueHelper::isDateTime($dateTime)) {
            return static::stringToDateTime($dateTime)->format($format);
        } else {
            return $null;
        }
    }
1123756
public static function parse($format, $time, DateTimeZone $timezone =  NULL) {
    if (!isset($timezone) && date_default_timezone_get() != '') {
      $timezone = new DateTimeZone(date_default_timezone_get());
    }

    $ret = parent::createFromFormat($format, $time, $timezone);
    
    if ($ret === FALSE) {
      throw new ParsingException('Aus '.Code::varInfo($time).' konnte keinen Zeitinformationen des Formates: '.Code::varInfo($format).' geparst werden. lastErrors: '.print_r(DateTime::getLastErrors(),true));
    }
    
    return new static($ret);
  }
270487
public static function isDateTime($date, string $format = null): bool
    {
        if ($date instanceof \DateTime) {
            return true;
        }

        if (false === is_string($date)) {
            return false;
        }

        if ($format) {
            return \DateTime::createFromFormat($format, $date) instanceof \DateTime;
        }

        return (bool)strtotime($date);
    }
677607
public static function date($format = "Y-m-d H:i:s", $time = null)
    {
        $time = ($time !== null ? $time : time());

        if (!is_numeric($time)) {
            $time = static::toUnix($time);
        }

        return date($format, $time);
    }
1195047
public function timeAgo($time = null, $format = null) {
		if (empty($time)) {
			$time = time();
		}
		if (empty($format)) {
			$format = '%x %X';
		}

		$result = $this->Html->tag(
			'time',
			$this->Time->i18nFormat($time, $format),
			[
				'data-toggle' => 'timeago',
				'datetime' => date('c', $this->Time->fromString($time)),
				'class' => 'help'
			]
		);

		return $result;
	}
1251381
def published(self, **kwargs):
		'''  
		'''
		return self.filter(
			Q(activate_date__lte=timezone.now()) | Q(
				activate_date__isnull=True),
			Q(deactivate_date__gte=timezone.now()) | Q(
				deactivate_date__isnull=True),
			Q(status=1), **kwargs)
156032
static public String getFormattedDateTime(long dt, TimeZone tz, String format)
    {
        SimpleDateFormat df = new SimpleDateFormat(format);
        if(tz != null)
            df.setTimeZone(tz);
        return df.format(new Date(dt));
    }
675673
public function isSameAs($format, DateTime $dt = null)
    {
        $dt = $dt ?: static::now($this->timezone());

        return $this->format($format) === $dt->format($format);
    }
220460
public function dateTimeWithTimezone(string $format = TimezonedDateTime::DISPLAY_FORMAT) : TimezonedDateTimeFieldBuilder
    {
        return new TimezonedDateTimeFieldBuilder($this->field->type(new TimezonedDateTimeType($format)));
    }
681352
public static function DateFormat($format, $date = null)
  {
    if (!empty($date) && !is_int($date)) {
      $date = strtotime($date);
    }

    return strftime($format, $date ?: time());
  }
326595
public function format(string $format, TimeZone $timeZone = null): string
    {
        if (null !== $timeZone) {
            return $timeZone->translate($this)->format($format);
        }

        return $this->dateTime->format($format);
    }