gple Posted March 20, 2008 Share Posted March 20, 2008 $time="20:00:00"; how do I put this variable as 8:00? Link to comment https://forums.phpfreaks.com/topic/97135-format-time/ Share on other sites More sharing options...
rhodesa Posted March 20, 2008 Share Posted March 20, 2008 one way.... <?php $time = "20:00:00"; $parts = explode(':',$time); if($parts[0] > 12) $parts[0] -= 12; print $parts[0].':'.$parts[1]; ?> Link to comment https://forums.phpfreaks.com/topic/97135-format-time/#findComment-497015 Share on other sites More sharing options...
ikmyer Posted March 20, 2008 Share Posted March 20, 2008 another... <?php $time = "20:00:00"; $new_time = date("h:i", strtotime($time)); ?> Link to comment https://forums.phpfreaks.com/topic/97135-format-time/#findComment-497025 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.