Reply to Re: [PHP] Re: date problem

Your name:

Reply:


Posted by "Mario netMines" on 06/29/05 04:35

Hi Jasper and thanks for the quick reply.

something tells me it's not a straightforward SQL query that I have to use
here but a logic using PHP and SQL.

Mario
----- Original Message -----
From: "Jasper Bryant-Greene" <jasper@bryant-greene.name>
To: <php-general@lists.php.net>
Sent: Wednesday, June 29, 2005 4:28 AM
Subject: [PHP] Re: date problem


> Firstly, this shouldn't be in the PHP list, as you're asking for help
> with SQL.
>
> Mario netMines wrote:
>> carrental_from (datetime field)
>> carrental_to (datetime field)
>> carrental_price (datetime field) [rates are per hour]
>
> carrental_price shouldn't be a datetime field, as it isn't a datetime
> value.
>
>> The values I have are like:
>> 0000-00-00 00:00:00,0000-00-00 07:00:00,10 (all year around 00:00-07:00)
>> 0000-00-00 07:00:00,0000-00-00 00:00:00,20 (all year around 07:00-00:00)
>> 2005-12-22 07:00:00,2006-01-02 00:00:00,15 (christmas period 00:00-07:00)
>> 2005-12-22 00:00:00,2006-01-02 07:00:00,25 (christmas period 07:00-00:00)
>>
>> The user selects dates ($from - $to) to rent a car and he gets the price
>> accordingly.
>> I can do a (($to-$from)/60/60) and get the total number of hours but
>> depending on the date and time you get a different result. Can anyone
>> help with the SQL?
>
> Read up on the MySQL DATEDIFF() function, if you are using MySQL. Other
> DBMSs should have an equiv. function.
>
> Jasper
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Back to original 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

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