选择语言 :

 Core_Date::formatted_time

Returns a date/time string with the specified timestamp format

$time = Date::formatted_time('5 minutes ago');

string Core_Date::formatted_time( [ string $datetime_str = string(3) "now" , string $timestamp_format = null , $timezone = null ] )
see
http://php.net/manual/en/datetime.construct.php

参数列表

参数 类型 描述 默认值
$datetime_str string Datetime_str datetime string string(3) "now"
$timestamp_format string Timestamp_format timestamp format null
$timezone unknown null
返回值
  • string
File: ./core/classes/date.class.php
public static function formatted_time($datetime_str = 'now', $timestamp_format = NULL, $timezone = NULL)
{
    $timestamp_format = ($timestamp_format == NULL) ? Date::$timestamp_format : $timestamp_format;
    $timezone = ($timezone === NULL) ? Date::$timezone : $timezone;

    $time = new DateTime($datetime_str, new DateTimeZone($timezone ? $timezone : date_default_timezone_get()));

    return $time->format($timestamp_format);
}