Re: Validate The Last Day of Month with server's clock????
| From: | Scott Fletcher | Date: | Wed, 13 Aug 2003 19:37:37 +0000 |
| Subject: | Re: Validate The Last Day of Month with server's clock???? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159479@lists.php.net to get a copy of this message | ||
Did a lot of searching on the internet and found a simple PHP code that does
the trick. How the code work is when you pick a month where you want the
last day to be in, then use the next month into the PHP script to get the
last day of the month you're looking for.
--snip--
//Want to see the last day of Febraury (Then insert the next
month to find out).
echo strftime("%d", mktime(0,0,0,3,0,2004));
--snip--
"Scott Fletcher" <scott@abcoa.com> wrote in message
news:20030813191537.73824.qmail@pb1.pair.com...
> Alright, interesting thought, never thought it would be possible. So,
what
> would the PHP script be when matching it against the clock or something?
> Perhap mktime(). Anyone know?
>
> Scott F.
>
> "Nicholas Robinson" <npr@bottlehall.freeserve.co.uk> wrote in message
> news:200308132005.29579.npr@bottlehall.freeserve.co.uk...
> The 'usual' trick is to set the date to the first day of the month after
the
> one you want and then subtract one day.
>
> HTH
>
> Nick
>
> On Wednesday 13 Aug 2003 8:00 pm, Scott Fletcher wrote:
> > Hi!
> >
> > Here's a trick script. We know that some months have the last day
> > which is 30 while other is 31. As for February, it can be either 28 or
> 29.
> > So, what's the trick in using the php to find out what is the last day
of
> > the month if you want to checked it against the server's clock to find
out
> > the last day of the month. Suppose it is this month or 3 months ago or
3
> > months from now. Anyone know?
> >
> > Thanks!
>
>