SUNIL16 Posted July 6, 2010 Share Posted July 6, 2010 Hi friends, How can i get month in numeric and year in date format mar/2008 date format. I need to store month value in one variable and year in other. for above $a=3, $b=2008 like this. Quote Link to comment https://forums.phpfreaks.com/topic/206891-how-can-i-get-month-value-in-a-date-format-monthyear/ Share on other sites More sharing options...
AbraCadaver Posted July 6, 2010 Share Posted July 6, 2010 Lots of ways. Here's one: list($a, $b) = explode('/', date('n/Y', strtotime(str_replace('/', ' ', 'mar/2008')))); Quote Link to comment https://forums.phpfreaks.com/topic/206891-how-can-i-get-month-value-in-a-date-format-monthyear/#findComment-1081922 Share on other sites More sharing options...
SUNIL16 Posted July 6, 2010 Author Share Posted July 6, 2010 Thanks AbraCadaver, Let me know other type of getting values, Let me learn more. Quote Link to comment https://forums.phpfreaks.com/topic/206891-how-can-i-get-month-value-in-a-date-format-monthyear/#findComment-1081927 Share on other sites More sharing options...
SUNIL16 Posted July 7, 2010 Author Share Posted July 7, 2010 How to do same in Mysql? Quote Link to comment https://forums.phpfreaks.com/topic/206891-how-can-i-get-month-value-in-a-date-format-monthyear/#findComment-1082486 Share on other sites More sharing options...
Pikachu2000 Posted July 7, 2010 Share Posted July 7, 2010 Look up MySQL's DATE_FORMAT() function. Quote Link to comment https://forums.phpfreaks.com/topic/206891-how-can-i-get-month-value-in-a-date-format-monthyear/#findComment-1082487 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.