This is a discussion on Help with Date within the PHP General forums, part of the PHP Programming Forums category; I need a function to create the dates of previous Fridays, in 21-JUL-2003 format. I figure this has ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I need a function to create the dates of previous Fridays, in
21-JUL-2003 format. I figure this has already been done, so I wanted to ask before I continued writing my own. Thanks, Elliot ===== -[ Elliot Tobin, elliot_tobin@yahoo.com ]- "America has never been united by blood or birth or soil. We are bound by ideals that move us beyond our backgrounds, lift us above our interests and teach us what it means to be citizens. Every child must be taught these principles. Every citizen must uphold them. And every immigrant, by embracing these ideals, makes our country more, not less, American." -- President Bush __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com |
|
|||
|
Hi Elliot,
> I need a function to create the dates of previous > Fridays, in 21-JUL-2003 format. It'll be different depending on what you want to happen if you pass a Friday timestamp to the function, but it should be something like: function friday($ts) { while (date("w", $ts) != 5) $ts -= 86400; return date("d-m-Y", $ts); } Cheers Jon |
|
|||
|
Ha. Not what I have in mind. :)
Adam Voigt wrote: >Umm. > >echo(date('U',strtotime('next Friday'))); > >Notice the strtotime part. > > >On Mon, 2003-07-21 at 09:25, John Manko wrote: > > >>I'd settle for a function that will generate a date for this upcoming >>friday. ;) >> >>Elliot Tobin wrote: >> >> >> >>>I need a function to create the dates of previous Fridays >>> >>> >>> >>> |
|
|||
|
More like:
echo(date('Jennifer Lopez',strtotime('next Friday'))); John Manko wrote: > Ha. Not what I have in mind. :) > > Adam Voigt wrote: > >> Umm. >> >> echo(date('U',strtotime('next Friday'))); >> >> Notice the strtotime part. >> >> >> On Mon, 2003-07-21 at 09:25, John Manko wrote: >> >> >>> I'd settle for a function that will generate a date for this >>> upcoming friday. ;) >>> >>> Elliot Tobin wrote: >>> >>> >>> >>>> I need a function to create the dates of previous Fridays >>>> >>>> >>>> >>> > > > |