PHP and date manipulation
| From: | Jeff | Date: | Sun, 13 Aug 2000 03:57:08 +0000 |
| Subject: | PHP and date manipulation | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11495@lists.php.net to get a copy of this message | ||
I was wondering if anyone has developed some functions
or classes for dealing with various date manipulations.
I wrote a bunch of these for our Y2K project and I could
port them to PHP or even to C and build a module for PHP
but I would prefer not to reinvent the wheel if someone
has it already.
For example, I would need the following:
Given a date, return date for the 1st of the month
Given a date, return date for last day of the month
Given a date, return 1st day of next month
Given a date, return last day of previous month
Given a date, a start date and an end date, return -1 if
date is earlier than both, +1 if later than both, 0 if between
or equal.
Adjust day by a given number of days, months or years, positive
or negative.
Given a date, return number of days remaining in the month.
Some of these are relatively trivial, others are more complicated,
but I would be interested in any canned scripts you may have
to solve these problems.
Thanks
Jeff