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. 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')))); 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. 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? 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. 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
Archived
This topic is now archived and is closed to further replies.