Bluehost.com Web Hosting $6.95

Help with Date

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-21-2003
Elliot Tobin
 
Posts: n/a
Default Help with Date

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
Reply With Quote
  #2 (permalink)  
Old 07-21-2003
Jon Haworth
 
Posts: n/a
Default Re: [PHP] Help with Date

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

Reply With Quote
  #3 (permalink)  
Old 07-21-2003
John Manko
 
Posts: n/a
Default Re: [PHP] Help with Date

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
>>>
>>>
>>>
>>>



Reply With Quote
  #4 (permalink)  
Old 07-21-2003
John Manko
 
Posts: n/a
Default Re: [PHP] Help with Date

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
>>>>
>>>>
>>>>
>>>

>
>
>



Reply With Quote
  #5 (permalink)  
Old 07-21-2003
Curt Zirzow
 
Posts: n/a
Default Re: [PHP] Help with Date

* Thus wrote Adam Voigt (adam@cryptocomm.com):
> Umm.
>
> echo(date('U',strtotime('next Friday')));


I prefer:

while(1) echo(date('U', strtotime('Saturday'));


Curt
--
"I used to think I was indecisive, but now I'm not so sure."
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:57 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0