hostfreak Posted July 30, 2007 Share Posted July 30, 2007 Hello, I was wondering if it were possible to take a number and format it to represent the corresponding month. For example: Say you have 01 (which we know would be January). How can I format it to be January? I am retrieving months from a datecolumn in a database with the mysql month() function. edit: I have discovered the mysql monthname() function, however I need to keep the value of the months as a number, so that wont work. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 30, 2007 Share Posted July 30, 2007 Sure, use the date and strtotime functions: <?php $month = 01; echo date('F',strtotime("$month/01")); ?> Quote Link to comment Share on other sites More sharing options...
hostfreak Posted July 30, 2007 Author Share Posted July 30, 2007 Ah, thanks GingerRobot. Quote Link to comment 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.