> -----Original Message-----
> From: Justin French [mailto:[EMAIL PROTECTED]]
> Sent: 03 December 2002 05:31
> 
> I'm looking to get a unix timestamp for the first and last 
> day of a month,
> given a timestamp. 
> 
> But so far everything i've come up with has been waaaay too 
> many lines of
> trickery -- especially for the last day of the month (which 
> isn't always 31)
> 
> Any ideas or snippets of code floating around?

In addition to other solutions, this may or may not be appropriate depending
on how you're handling your dates, but on the manual page for mktime is the
following:

> The last day of any given month can be expressed as the "0"
> day of the next month, not the -1 day. Both of the following
> examples will produce the string "The last day in Feb 2000
> is: 29".
>
>   $lastday = mktime (0,0,0,3,0,2000);
>   echo strftime ("Last day in Feb 2000 is: %d", $lastday);
>     
>   $lastday = mktime (0,0,0,4,-31,2000);
>   echo strftime ("Last day in Feb 2000 is: %d", $lastday);


Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to