Hi, I'm currently using the follow code to explode a date: PHP Code: 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
just do it like this. $y = date('Y',strtotime('2011-07-26 17:18:20')); $m = date('m',strtotime('2011-07-26 17:18:20')); $d = date('d',strtotime('2011-07-26 17:18:20')); PHP:
I finally figured it out like this: list($y, $m, $d) = explode('-', substr($postted_date, 0, 10)); I was supposed to be grabbing the first 10 chars of the $postted_date, not 9.