note 109727 rejected from function.date-diff by aharvey

From: Date: Wed, 15 Aug 2012 01:51:42 +0000
Subject: note 109727 rejected from function.date-diff by aharvey
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-190075@lists.php.net to get a copy of this message
Note Submitter: chistyakov dot dmitry at gmail dot com ---- Hey guys, i need to get the difference between 2 dates adjasted in monthes. <?php $start_time = strtotime(date('Y-m-01', strtotime('2012-08-14'))); $current_time = strtotime(date('Y-m-01')); $five_weeks_time = 5 * 7 * 86400; $monthes = array(); $process_time = $start_time; while( date('Y-m-01', $process_time) != date('Y-m-01') ){ $process_time = strtotime(date('Y-m-01', $process_time)) + $five_weeks_time; $monthes[] = date('M', $process_time); } ?> array(13) { [0]=> string(3) "Aug" [1]=> string(3) "Sep" [2]=> string(3) "Oct" [3]=> string(3) "Nov" [4]=> string(3) "Dec" [5]=> string(3) "Jan" [6]=> string(3) "Feb" [7]=> string(3) "Mar" [8]=> string(3) "Apr" [9]=> string(3) "May" [10]=> string(3) "Jun" [11]=> string(3) "Jul" [12]=> string(3) "Aug" }

« previous php.notes (#190075) next »