Re: date calculation
| From: | Stephen Willcock | Date: | Sun, 16 Feb 2003 21:34:28 +0000 |
| Subject: | Re: date calculation | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135779@lists.php.net to get a copy of this message | ||
Yes, will be OK with all dates (though the valid range of a timestamp is
typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07
GMT.)
The function you want for numeric dates is:
int mktime ( int hour, int minute, int second, int month, int day, int year)
so, in your example (1st Feb 2003):
$mydate = mktime(0,0,0,2,1,2003);
SW
"Qt" <web_tur@yahoo.com> wrote in message
news:20030216151813.83669.qmail@pb1.pair.com...
> Dear Stephen,
>
> Good clue!!
>
> Is it working allways without problem such as 29 feb?
>
> And one more hel how can I write "1 2 2003" instead of "1 february 2003"
>
> I wrote but directly but doesn' t work
>
> thanks
>
> "Stephen Willcock" <stephen.willcock@virgin.net> wrote in message
> news:20030216140648.58868.qmail@pb1.pair.com...
> > Try:
> >
> > $today = strtotime ("1 february 2003");
> > $enddate = strtotime ("2 february 2003");
> > $diff = $enddate - $today;
> >
> > Should give you a clue!
> >
> > SW
> >
> >
> > "Qt" <web_tur@yahoo.com> wrote in message
> > news:20030216134414.47538.qmail@pb1.pair.com...
> > > Dear Kevin,
> > >
> > > I used timestamp allready as following;
> > >
> > > $today = strtotime ("1 february 2003");
> > > $enddate = strtotime ("1 march 2003");
> > >
> > > $diff = $enddate - $today;
> > >
> > > But result comes as
> > >
> > > 2419200
> > >
> > > How can I convert that numbers to days
> > >
> > > Best Regards
> > >
> > >
> > >
> > > "Kevin Waterson" <kevin@oceania.net> wrote in message
> > > news:20030216234336.21fbdb98.kevin@oceania.net...
> > > > This one time, at band camp,
> > > > "qt" <web_tur@yahoo.com> wrote:
> > > >
> > > > > Dear Sirs,
> > > > >
> > > > > How can I add or subtract two date easily. Is therea any lib or
> > function
> > > > > about this. I can not find any easy way in the manual
> > > >
> > > > if the dates are timestamps, simply
> > > >
> > > > $new = $timestamp2 - $timestamp1;
> > > >
> > > > cheers
> > > > Kevin
> > > >
> > > > --
> > > > ______
> > > > (_____ \
> > > > _____) ) ____ ____ ____ ____
> > > > | ____/ / _ ) / _ | / ___) / _ )
> > > > | | ( (/ / ( ( | |( (___ ( (/ /
> > > > |_| \____) \_||_| \____) \____)
> > > > Kevin Waterson
> > > > Port Macquarie, Australia
> > >
> > >
> >
> >
>
>