Jump to content

Removing the 0 in 07:06 am


Shadowing

Recommended Posts

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>"; 

Link to comment
https://forums.phpfreaks.com/topic/255795-removing-the-0-in-0706-am/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.