简体   繁体   中英

problem with echo variable in function strtotime()

why not worked echo (function strtotime) in this code?
not displaying anything.

$ok = '2011/07/18'; 
echo strtotime($ok);

I tried your code and it worked fine.

#!/usr/bin/php
<?php


$ok = '2011/07/18';
echo strtotime($ok);


echo date("F j, Y, g:i:s a",strtotime($ok));
?>

Response: 1310965200July 18, 2011, 12:00:00 am

I personally didn't get anything unexpected . Are you aware you're going to get a number in response to strtotime and not a formatted date? You'd have to make a call to strftime (or similar) to format it back.

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