php - how to find the month names and numbers between two dates? -


this question has answer here:

i need find month names , numbers between 2 dates above 2 variables, how find out month numbers, ie) output goes

aug2016,sep2016,oct2016,nov2016,dec2016,jan2017

<?php  $date1  = '2013-11-15'; $date2  = '2014-02-15'; $output = []; $time   = strtotime($date1); $last   = date('m-y', strtotime($date2));  { $month = date('m-y', $time); $total = date('t', $time);  $output[] = $month;  $time = strtotime('+1 month', $time); } while ($month != $last);  echo implode(",", $output); ?> 

output

nov-2013,dec-2013,jan-2014,feb-2014  

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -