jeff5656 Posted October 22, 2009 Share Posted October 22, 2009 Lets say I have a variable $test = 05 Now I want to echo: May in this case since that's the 5th month. How would I do this? I tried echo date("M",$test); but that didn't work Link to comment https://forums.phpfreaks.com/topic/178634-one-more-easy-date-question/ Share on other sites More sharing options...
cags Posted October 22, 2009 Share Posted October 22, 2009 There are several ways, here's one... echo date('F', mktime(0,0,0,$test,0,0)); Link to comment https://forums.phpfreaks.com/topic/178634-one-more-easy-date-question/#findComment-942239 Share on other sites More sharing options...
Daniel0 Posted October 22, 2009 Share Posted October 22, 2009 There are several ways, here's one... echo date('F', mktime(0,0,0,$test,0,0)); Though it'll have to be echo date('F', mktime(0,0,0,$test,1,0)); because days aren't zero-indexed. Link to comment https://forums.phpfreaks.com/topic/178634-one-more-easy-date-question/#findComment-942242 Share on other sites More sharing options...
cags Posted October 22, 2009 Share Posted October 22, 2009 Ahh, good point. I was concentrating more on making sure I had the right about of arguments rather than thinking about what they actually were Link to comment https://forums.phpfreaks.com/topic/178634-one-more-easy-date-question/#findComment-942244 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.