Calculate future months
From: Tencip (tencip_at_yahoo.com)
Date: 08/31/04
- Next message: Berislav Lopac: "Re: PHP files without extension"
- Previous message: Berislav Lopac: "Re: PHP files without extension"
- Next in thread: Ken Robinson: "Re: Calculate future months"
- Reply: Ken Robinson: "Re: Calculate future months"
- Reply: Tim Van Wassenhove: "Re: Calculate future months"
- Reply: John Murtari: "Re: Calculate future months"
- Reply: Steve: "Re: Calculate future months"
- Reply: Nikolai Chuvakhin: "Re: Calculate future months"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Aug 2004 06:25:48 -0700
Hi everyone,
I'm trying to build a simple script that does the following. It
should find today's month and year, and then go into a DB query string
and look for all records that are from this month and the next three
months.
I've been playing around with the date() function for a while now, and
from that I can pull today's month and year, but I'm having problems
with the transition from December to January. For instance, when i
use the date function to get the current month, which for example say
is December, when i try to get the third month after that, my current
function adds 3 to the current month (which is 12), and gets 15. I'm
not sure what quite to do to make a simple function that will wrap
back around to January (which would be 1). Additionally, at the end
of the year, the year function has to change as well. So, three
months after December 2004 is March 2005, so the calculation needs to
recognize that because my month has gone over 12, I need to add 1 to
my year.
Anyone face something similar to this?
Best,
tencip
- Next message: Berislav Lopac: "Re: PHP files without extension"
- Previous message: Berislav Lopac: "Re: PHP files without extension"
- Next in thread: Ken Robinson: "Re: Calculate future months"
- Reply: Ken Robinson: "Re: Calculate future months"
- Reply: Tim Van Wassenhove: "Re: Calculate future months"
- Reply: John Murtari: "Re: Calculate future months"
- Reply: Steve: "Re: Calculate future months"
- Reply: Nikolai Chuvakhin: "Re: Calculate future months"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|