コード例 #1
0
ファイル: functions.php プロジェクト: sabdev1/ljcdevsab
/**
 * Returns the given date as MySQL date string, Unix timestamp or
 * using a custom format.
 *
 * @since 3.0.2
 * @param $format 	'mysql', 'timestamp', 'awpcp', 'awpcp-date', 'awpcp-time'
 *					  or first arguemnt for date() function.
 */
function awpcp_datetime($format = 'mysql', $date = null)
{
    if (is_null($date) || strlen($date) === 0) {
        $timestamp = current_time('timestamp');
    } else {
        if (is_string($date)) {
            $timestamp = strtotime($date);
        } else {
            $timestamp = $date;
        }
    }
    switch ($format) {
        case 'mysql':
            return date('Y-m-d H:i:s', $timestamp);
        case 'timestamp':
            return $timestamp;
        case 'awpcp':
            return date_i18n(awpcp_get_datetime_format(), $timestamp);
        case 'awpcp-date':
            return date_i18n(awpcp_get_date_format(), $timestamp);
        case 'awpcp-time':
            return date_i18n(awpcp_get_time_format(), $timestamp);
        default:
            return date_i18n($format, $timestamp);
    }
}
コード例 #2
0
ファイル: functions_awpcp.php プロジェクト: sabdev1/ljcdevsab
function awpcp_format_email_sent_datetime()
{
    $time = date_i18n(awpcp_get_datetime_format(), current_time('timestamp'));
    return sprintf(__('Email sent %s.', 'AWPCP'), $time);
}