Re: [PHP] Date to find next Friday

2002-10-08 Thread 1LT John W. Holmes

 Using the date function, what's the easiest way to find the date of the
next
 Friday?

Why use the date() function?

$next_friday = strtotime(next friday);

---John Holmes...


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




RE: [PHP] Date to find next Friday

2002-10-08 Thread Liam . Gibbs

Responding to my own message. This is making me a little ticked. I can't
think it through. Here's exactly what I need:

There are a bunch of series of files (A series, B series, and so on) that
are to be released on the first, second, third, fourth, or (if it exists for
that month) fifth Friday of a given month. The A series does not necessarily
get released on the same Friday of each month as the B series, so the A
series could come out on the fourth Friday, while the B series comes out on
the third and the C on the fifth, etc. or whatever. I need to know the
Next_Release_Friday of a specified series.

If there are only four Fridays that month, all those fifth-Friday releases
happen on the fourth Friday.

Obviously, if a file is released on the first Friday and it so happens that
the first Friday for this month has passed, the Next_Release_Friday will be
next month, and if it's December, the Next_Release_Friday will be next
year's January.

Does everybody follow me? It's even confusing trying to ask the question,
let alone derive the proper date.

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




Re: [PHP] Date to find next Friday

2002-10-08 Thread Justin French

Ummm, I've read this twice, and don't get it!!!

You want to make:

- an 'A' file available on the first friday of the month
- an 'B' file available on the second friday of the month
- an 'C' file available on the third friday of the month
- an 'D' file available on the fourth friday of the month
- an 'E' file available on the fifth friday of the month, or on the 4th
friday if the 5th doesn't exist???

correct?

Are they ONLY published on that day, or are they made available permanently
from that date onwards?

How are these files stored?  Are these files created by a human? Or a
program?


It seems to me that your aim is to:
- find out if today is a friday
- find out if it's the 1st/2md/3rd/4th/5th friday of the month
- look for a file that needs to be made available or displayed
- if it exists, display it
... and it sounds like you'd need to do this EVERYTIME the script runs.


Instead, perhaps what you need to do is AT THE POINT OF CREATING THE FILE,
name it 2002-11-10.txt (the date of next friday), and then all you have to
do is search for files with a date == today or in the past, and display
them.


I think you need to think the problem through clearly, and generally the
problem can solve itself, or at the very least, the question becomes clear.


Justin




on 09/10/02 1:28 AM, [EMAIL PROTECTED]
([EMAIL PROTECTED]) wrote:

 Responding to my own message. This is making me a little ticked. I can't
 think it through. Here's exactly what I need:
 
 There are a bunch of series of files (A series, B series, and so on) that
 are to be released on the first, second, third, fourth, or (if it exists for
 that month) fifth Friday of a given month. The A series does not necessarily
 get released on the same Friday of each month as the B series, so the A
 series could come out on the fourth Friday, while the B series comes out on
 the third and the C on the fifth, etc. or whatever. I need to know the
 Next_Release_Friday of a specified series.
 
 If there are only four Fridays that month, all those fifth-Friday releases
 happen on the fourth Friday.
 
 Obviously, if a file is released on the first Friday and it so happens that
 the first Friday for this month has passed, the Next_Release_Friday will be
 next month, and if it's December, the Next_Release_Friday will be next
 year's January.
 
 Does everybody follow me? It's even confusing trying to ask the question,
 let alone derive the proper date.


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