Convert a String To DateTime Format

Hi experts,

I have a problem with datetime format in PHP

Example :  I have a string :  "2007-10-06 20:45:00" (a datetime string) , and How to that string convert to "20:45 06-10" ?

Thanks & Regards
TrungGN
trung85gnAsked:
Who is Participating?
 
MacAnthonyCommented:
Try:

<?

print date('H:i d-m', strtotime('2007-10-06 20:45:00'));

?>

If you want to change the format, you can find the codes here: http://www.php.net/manual/en/function.date.php
0
 
Kiran Paul VJComputer EngineerCommented:
0
 
MacAnthonyCommented:
If you use mktime, you will need to parse the original time format. IMO, it's easier to let strtotime parse it.
0
 
trung85gnAuthor Commented:
Thanks & Regards

TrungGN
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.