Can somebody help me to write PHP function ? - Just in Time alghoritm.

This is a discussion on Can somebody help me to write PHP function ? - Just in Time alghoritm. within the PHP Language forums, part of the PHP Programming Forums category; mario said the following on 23/05/2006 13:31: > Hi, I have verry big problem. > I must ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-23-2006
Oli Filth
 
Posts: n/a
Default Re: Can somebody help me to write PHP function ? - Just in Time alghoritm.

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
Reply With Quote
  #2 (permalink)  
Old 05-23-2006
mario
 
Posts: n/a
Default Can somebody help me to write PHP function ? - Just in Time alghoritm.


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.

Thanks All for answer

--
mari
-----------------------------------------------------------------------
mario's Profile: http://techiegroups.com/member.php?userid=9
View this thread: http://www.techiegroups.com/showthread.php?t=10939

Reply With Quote
  #3 (permalink)  
Old 05-24-2006
..::MARIO::..
 
Posts: n/a
Default Re: Can somebody help me to write PHP function ? - Just in Time alghoritm.

I want to sort everything for example:
I must produce 200 parts. (it is 200*20 sec.) to 2006-01-01

I must sort all dates before, from min to max (max to min) and add all
results, then I must convert (reverse) into the dates.
p.s. sorry my English ist't good.
Mario

Uzytkownik "Oli Filth" <catch@olifilth.co.uk> napisal w wiadomosci
news:KdDcg.941$c76.427@newsfe1-win.ntli.net...
> 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



Reply With Quote
Reply


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

vB 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 08:02 PM.


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