You are here: Re: Can somebody help me to write PHP function ? - Just in Time alghoritm. « PHP Programming Language « IT news, forums, messages
Re: Can somebody help me to write PHP function ? - Just in Time alghoritm.

Posted by Oli Filth on 11/11/06 11:48

mario said the following on 23/05/2006 13:31:
> Hi, I have verry big problem.
> I must write function using dates.
> This is a problem:
> I have some dates for example: 2006-01-01, 2006-02-05, 2006-10-15 etc.
>
> then some times: 20sec, 50sec, 45sec etc
> and some quantity of parts: 200, 300, 240
> ---------------------------------------------------------------------
> I must sort dates,times and quanties, then I must calculate:for ex.
> 2006-01-01+200*20, etc. and then add next date+quanntity*time. Please
> HELP me.
> It's like "Just In Time" alghoritm, I thing.
>

This is best achieved by converting the dates to timestamps (number of
seconds since 01/01/1970), using mktime(). Once you've done that, you
can add your ($quantity * $time) to the timestamp, and then reconvert
using date().

Quite what it is you want to sort, I'm not sure. But timestamps are
very easy to sort, as they're just integers.


--
Oli

 

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

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