Re: date problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 1, 2011 at 12:35, Dan Dan <dani.mani.99@xxxxxxxxx> wrote:
> Hi Folks,
>
> I am trying to get the day of month for a particular day of week (e.g.
> Tuesday) for the first, second, third, fourth week in a month. The code i
> have seems issues in March, but works e.g. in April:
>
> print date("d-m-Y H:i:s",strtotime('1 March 2011 Tuesday'));
>>> 01-03-2011 00:00:00
>
> print date("d-m-Y H:i:s",strtotime('1 March 2011 first Tuesday'));
>>> 08-03-2011 00:00:00
>
> While in April, I have
>
> print date("d-m-Y H:i:s",strtotime('1 April 2011 Tuesday'));
>>> 05-04-2011 00:00:00
>
> print date("d-m-Y H:i:s",strtotime('1 April 2011 first Tuesday'));
>>> 05-04-2011 00:00:00
>
> Could someone help whats wrong with the technique i am trying to find that
> day of month. Is there any better way ?

    Because you're combining the date with the day of the week.  It so
happens that 1 March was a Tuesday, but today - 1 April - is a Friday.
 Pick one or the other, not both.

-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux