You are here: Re: Intersecting Dates « PHP « IT news, forums, messages
Re: Intersecting Dates

Posted by "M. Sokolewicz" on 11/27/05 00:35

Shaun wrote:

> Hi,
>
> Given a start day and month and end day and month (i.e. 01-01 to 31-03) how
> can one check if another set intersects these dates?
>
> Thanks for your advice
one possibility is to change the dates to timestamps, then check if the
starting date (to intersect) is > $start or < $end, and check if the end
date (intersect) is > $start or < $end. If any of those are true, it
intersects.
(use strtotime() or some similair function to change 01-01 => 31-03)

another would be splitting dates and doing the same thing for months,
followed by days (if months of both equal)

other possibilities also exist obviously (eg. you could use mysql's
BETWEEN syntax)

- tul

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация