Hi,
I’m currently using the follow code to explode a date:
list($y, $m, $d) = explode('-', substr($postted_date, 0, 9));
The postted_date looks like this:
2011-07-26 17:18:20
Its definitely breaking up the date to list the year, month and day, but for example with the above date for month its only displaying the ‘7’ and I need it to display the month as ‘07’. Same case with the day.
Suggestions?
Thanks
You’re not taking in account the time part of the string, which is getting tacked on the end of $d. 
<?php
list($y, $m, $d) = sscanf('2011-07-26 17:18:20', '%d-%d-%d %s');
The 9 part means its only reading the first 9 characters in the date.
I did try your code though and still only returned the date as 7, no 07. 
And I need the first 10 characters of the date…
Now its working:
list($y, $m, $d) = explode('-', substr($postted_date, 0, 10));
Could also just push the string into a datetime object and reference them from there, that way you dont have to worry about string lengths and such.