View Full Version : Converting Time in PHP

07-02-2007, 10:14 AM
I have an application that gives me numbers like 1183354915 and the php coding converts it into a time.

print date('d m Y', $row['topic_time']);

Are there any converters that will allow me to input July 2, 10:59PM and it will spit out that number?

Thank You,
Brad C

07-02-2007, 11:01 AM
Yes, you can! I would suggest reading the manual first.. but I mean there are so
many functions so I don't blame you.. anyhow this is how to do it..

$string = "July 2, 10:59PM";
echo strtotime($string);


echo strtotime("July 2, 10:59PM");

and forgot output.. this is what it'll output "1183417140" :D

Enjoy! :D

07-02-2007, 06:04 PM
All this does it provides the output of "-1" Am I missing something?

Thank You,

07-03-2007, 09:18 AM
You must be, because it outputs exactly as I put it in both examples.

07-03-2007, 09:35 AM
Just so you no, there is another function quite useful in generating time stamps:


Look it up on php.net

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum