Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #5041
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: strtotime() not able to handle 04/29 correctly??? |
| Date | 2012-02-29 16:21 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <jim4st$184$1@dont-email.me> (permalink) |
| References | <a63a7827-bc1a-483a-96ae-de8289aa2de0@32g2000yqn.googlegroups.com> |
On 2/29/2012 1:41 PM, cerr wrote: > Hi, > > I calculate the amount of days between two dates like this: > > $start = strtotime($_SESSION['sdate']); > $end = strtotime($_SESSION['hdate']); > echo ($end - $start); > $duration = ($end - $start) / 3600 /24; > $duration+=1; //plus one day > echo " The ad will show for ".$duration." day(s)<br/>"; > > Which generally works fine but things seem to mess up when I have a > start sdate of 2012-02-29 and an hdate of 2012-04-01. I get a duration > of: 32.9583333333 > Why is this? That's messing up my calculations. Is there a better way > to do this? > > Thanks! > Ron Daylight savings time. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
strtotime() not able to handle 04/29 correctly??? cerr <ron.eggler@gmail.com> - 2012-02-29 10:41 -0800
Re: strtotime() not able to handle 04/29 correctly??? "Peter H. Coffin" <hellsop@ninehells.com> - 2012-02-29 14:19 -0600
Re: strtotime() not able to handle 04/29 correctly??? Jerry Stuckle <jstucklex@attglobal.net> - 2012-02-29 16:21 -0500
Re: strtotime() not able to handle 04/29 correctly??? Doug Miller <doug_at_milmac_dot_com@example.com> - 2012-02-29 23:24 +0000
Re: strtotime() not able to handle 04/29 correctly??? Eli the Bearded <*@eli.users.panix.com> - 2012-03-01 00:25 +0000
Re: strtotime() not able to handle 04/29 correctly??? The Natural Philosopher <tnp@invalid.invalid> - 2012-03-01 00:46 +0000
Re: strtotime() not able to handle 04/29 correctly??? Doug Miller <doug_at_milmac_dot_com@example.com> - 2012-03-01 01:28 +0000
csiph-web