phpretard Posted July 26, 2009 Share Posted July 26, 2009 I need to print out the time but I cant figure??? $calls['stamp']="2009-07-26 12:02:53"; $startdate=$calls['stamp']; $predate=explode(' ', $startdate); $splitdate=explode('-', $predate[0]); $Date="$splitdate[1]-$splitdate[2]-$splitdate[0]"; This prints out "07-26-2009"; I need the time as well. Any help? Link to comment https://forums.phpfreaks.com/topic/167506-solved-wanna-date/ Share on other sites More sharing options...
mmarif4u Posted July 26, 2009 Share Posted July 26, 2009 $calls['stamp']="2009-07-26 12:02:53"; $startdate=$calls['stamp']; $predate=explode(' ', $startdate); $splitdate=explode('-', $predate[0]); $splittime=explode(':', $predate[1]); $Date="$splitdate[1]-$splitdate[2]-$splitdate[0]"; $time=$splittime[0].":".$splittime[1].":".$splittime[2]; Link to comment https://forums.phpfreaks.com/topic/167506-solved-wanna-date/#findComment-883299 Share on other sites More sharing options...
zq29 Posted July 26, 2009 Share Posted July 26, 2009 echo $predate[1]; Link to comment https://forums.phpfreaks.com/topic/167506-solved-wanna-date/#findComment-883300 Share on other sites More sharing options...
vineld Posted July 26, 2009 Share Posted July 26, 2009 Why not simply use date() instead? Link to comment https://forums.phpfreaks.com/topic/167506-solved-wanna-date/#findComment-883309 Share on other sites More sharing options...
phpretard Posted July 26, 2009 Author Share Posted July 26, 2009 Thanks!!! Link to comment https://forums.phpfreaks.com/topic/167506-solved-wanna-date/#findComment-883310 Share on other sites More sharing options...
Psycho Posted July 26, 2009 Share Posted July 26, 2009 Assuming you don't need to reuse all those variables: $calls['stamp']="2009-07-26 12:02:53";; echo date('n-j-Y g:i:s', strtotime($calls['stamp'])); // Output:7-26-2009 12:02:53 Link to comment https://forums.phpfreaks.com/topic/167506-solved-wanna-date/#findComment-883343 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.