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. Link to comment https://forums.phpfreaks.com/topic/62537-solved-number-to-represent-its-month/ 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")); ?> Link to comment https://forums.phpfreaks.com/topic/62537-solved-number-to-represent-its-month/#findComment-311272 Share on other sites More sharing options...
hostfreak Posted July 30, 2007 Author Share Posted July 30, 2007 Ah, thanks GingerRobot. Link to comment https://forums.phpfreaks.com/topic/62537-solved-number-to-represent-its-month/#findComment-311278 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.