Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将Wordpress长文本值转换为有效日期_Php_Mysql_Date_Type Conversion - Fatal编程技术网

Php 将Wordpress长文本值转换为有效日期

Php 将Wordpress长文本值转换为有效日期,php,mysql,date,type-conversion,Php,Mysql,Date,Type Conversion,我是新来的wordpress。并在Wordpress、PHP和MYSQL中工作。我有一个数据库表,其中所有凭证到期日期都以如下长文本格式保存: meta_id post_id meta_key meta_value 446 405 _end_time 1362483186 460 411 _end_time 1363046400 474 4

我是新来的wordpress。并在Wordpress、PHP和MYSQL中工作。我有一个数据库表,其中所有凭证到期日期都以如下长文本格式保存:

       meta_id  post_id     meta_key        meta_value
        446     405     _end_time           1362483186
        460     411     _end_time       1363046400
        474     413     _end_time       1362787200
        488     418     _end_time       1363392000
        503     420     _end_time       1363219200

我是否可以将meta_值从Longtext转换为Date,以便与用户输入(Date)进行比较?请告知。

您的长文本格式是时间戳,用于将其转换为字符串:

$timestamp = 1362483186;
echo date('m d Y', $timestamp);
//With 1362483186 it'll give 03 05 2013 (month day year)
//See the php docs for more format types

如果需要与实际时间进行比较,请参见该函数。

它是一个
UNIX时间戳
。您可以使用函数转换它。@Rikesh。谢谢Rikesh。我需要使用什么格式?我是说任何例子?对不起,我是新蜜蜂。谢谢。那一个对我有用。但是我怎么能检查它是日期时间还是简单的日期?是否存在,因为我只是不想放弃它附带的时间值?请建议我不理解你的问题,从时间戳你也可以检索时间。试试:
echo date('l jS\of F Y h:i:sa',$timestamp)
@soyuka。谢谢。我已经得到了答案。干杯:)