date - php get last day of given month -


i want output of last , first date of given month of current year. using code not works

$month='02'; $first_day_this_month = date('y-'.$month.'-01'); // hard-coded '01' first day $last_day_this_month  = date('y-'.$month.'-t');  echo $first_day_this_month;print'<->';echo $last_day_this_month; 

my output shows

2015-02-01<->2015-02-31 

but 2015-02-01<->2015-02-28

i have had problem php before, try following way:

$datetotest = "2015-02-01"; $lastday = date('t',strtotime($datetotest)); 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -