mysql2date()将mysql格式的日期翻译成php函数date()可接收的格式

目录

描述

译文

将mysql格式的日期翻译成php函数date()可接收的格式

原文

Converts given MySQL date string into a different format.

mysql2date() 描述

用法

<?php $date mysql2date$format$date$translate ); ?>

mysql2date() 用法

参数

$format

(string) (必填) The requested output format, should be either a PHP date format string, e.g. 'U' for a Unix timestamp, or 'G' for a Unix timestamp assuming that $date is GMT.

默认值: None

$date

(string) (必填) the input string, this cannot be the raw time-stamp, it has to be converted into the following format first: 'Y-m-d H:i:s' . This is the only way mysql2date() will recognize your date.

默认值: None

$translate

(boolean) (可选) If true then the given date and format string will be passed to date_i18n() for translation.

默认值: true

mysql2date() 参数

返回值

(string|integer

Formatted date string, or Unix timestamp.

mysql2date() 返回值

示例

Convert a MySQL date to a Unix timestamp:

Convert a MySQL date to another date format:

mysql2date() 示例

历史

添加于 版本: 0.71

mysql2date() 历史

源文件

mysql2date() 函数的代码位于 wp-includes/functions.php

mysql2date() 源文件

相关