How do I parse this data?
This is a datetime that were from my database
2011-09-27 13:14:11
I want to get only the 13 14 and 11 separately.
the output should be:
13
14
11
Please be noted that this is a dynamic value
I could also get a datetime that has this value:
2011-09-27 1:12:00
How would I do that?
Any help would be greatly appreciated.
Thanks!
Let’s say you’ve assigned
2011-09-27 13:14:11from db table to variable named$datetimeIn your case
$hourwill be 13,$minutewill be 14,$secondwill be 11. More detailed in PHP documentationBTW
if you want to get seperate year, month, day too, use following piece of code