简体   繁体   中英

PHP strtotime not working with while array

I have one question about setlocale and strftime. I have this query:

<?php   
$post_query = "SELECT * FROM posts WHERE post_id AND post_title = 'test' ORDER BY `post_id` DESC ";
$pp = mysql_query($post_query);
$pps = array();
while($row=mysql_fetch_array($pp)){
    $pps[] = $row;
}
?>

and i am using this echo :

<?php 
setlocale(LC_TIME, 'tr_TR.UTF-8');  
echo strftime("%d %B %Y ", strtotime($pps[0]['post_time'])); 
?>

but this code shows me 01 January 1970 . What is the problem here anyone can tell me ? What should I do here to show the correct time?

try var_dump($pps); if you are having a problems post_time is not true. Take a look at your database table name post_time is true or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM