RE: Month Values in UNIX timestamps and workaround(Newbie)
| From: | Tim Ward | Date: | Thu, 30 May 2002 11:31:30 +0000 |
| Subject: | RE: Month Values in UNIX timestamps and workaround(Newbie) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-99882@lists.php.net to get a copy of this message | ||
If you just want the number of seconds in each month then ...
function SecondsInMonth($month, $year)
{ return mktime(0,0,0,$month + 1, 1, $year) - mktime(0,0,0,$month, 1,
$year);
}
... works, although you may need to play around with the is_dst parameter to
fine tune it.
Tim ward
www.chessish.com <http://www.chessish.com>
----------
From: webmaster@tececo.com [SMTP:webmaster@tececo.com]
Sent: 30 May 2002 04:37
To: php-general@lists.php.net
Subject: Month Values in UNIX timestamps and workaround(Newbie)
I began to write a function that correctly diveded up the months
into their correct UNIX timestamps and wrote content from a database
accordingly.
I have had an idea that maybe eaiser to implement but slower. Could
one or two people tell me what the think and if it is a good idea. I am also
interested in speed and efficiany of both methods.
The original method is:
I do a few maths functions to get the value in seconds of each month
etc
New Method:
I do string compares with with dates then convert them to UNIX
timestamps.
JJ Harrison
webmaster@tececo.com <mailto:webmaster@tececo.com>
www.tececo.com <http://www.tececo.com>