首页 WordPress函数大全 mysql2date()

mysql2date()

2020-05-02 / 4139阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

mysql2date( string $format, string $date, bool $translate = true )

将给定的MySQL日期字符串转换为其他格式。

描述

$ format应该是PHP日期格式字符串。“ U”和“ G”格式将返回带有时区偏移量的时间戳总和。$ date应该是MySQL格式的本地时间(Ymd H:i:s)。

从历史上看,UTC时间可以传递给函数以产生Unix时间戳。

如果$ translate为true,则给定的日期和格式字符串将传递给wp_date()进行翻译。

参数

$format

(string)
(Required)
Format of the date to return.

$date

(string)
(Required)
Date string to convert.

$translate

(bool)
(Optional)
Whether the return date should be translated.

Default value: true

返回

(string|int|false) Formatted date string or sum of Unix timestamp and timezone offset. False on failure.

大家谈论
    我的见解