You are here: Re: datediff / dateadd « PHP Language « IT news, forums, messages
Re: datediff / dateadd

Posted by Hilarion on 09/06/05 15:03

> I am looking for a functin / class which adds some days to a date or
> calculates the difference between 2 dates taking care of weekends - so: i
> want to work with WORKING days.


Sorry for not having answer for your question. I have some question instead:
It's quite obvious that distance between some tuesday and the same tuesday
is zero, distance between the tuesday and wednsday is one, to thursday is two,
to friday is three, but to saturday? Is it again three, or is it four?
Same with sunday. To monday it's probably four, and to the next tuesday
it should be five. What if we count distance between eg. saturday and some
next days? From saturday to the same saturday is zero, bu to the sunday is
it still zero? Is it also zero to monday? From saturday to next saturday
it should be five, but those in between are a problem.

My general sugestion which should give some results is to move start
date to the end of week, move end date to end of previous week, calculate
standard day difference, divide it by 7 (geting count of weeks) and multiply
by 5 (count of working days in a week) and add to the result the working
days in the start week and end week (the days which were not counted
because of moving the dates).


Hilarion

 

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

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