Shadowing Posted January 25, 2012 Share Posted January 25, 2012 Hey guys, im using UNIX time and trying to figure out how to remove the leading 0 when it shows the hour. "07:06 am" to make it read "7:06 am" manual says i need to use %i with strftime. So I guess Im suppose to be removing the zero before the date format? which is why strftime isnt working after the date function. Or is there a way to do this in the date function. $time = 1327493219; date_default_timezone_set('UTC'); $user_offset = date('h:i a M/d', $time); echo "<td>". strftime("%l",$user_offset) ."</td>"; Quote Link to comment https://forums.phpfreaks.com/topic/255795-removing-the-0-in-0706-am/ Share on other sites More sharing options...
scootstah Posted January 25, 2012 Share Posted January 25, 2012 Change $user_offset = date('h:i a M/d', $time); To $user_offset = date('g:i a M/d', $time); Quote Link to comment https://forums.phpfreaks.com/topic/255795-removing-the-0-in-0706-am/#findComment-1311264 Share on other sites More sharing options...
Shadowing Posted January 25, 2012 Author Share Posted January 25, 2012 thanks scootstah I must of over looked what g was for. Quote Link to comment https://forums.phpfreaks.com/topic/255795-removing-the-0-in-0706-am/#findComment-1311266 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.