At 08:34 AM 1/4/2006, Amos Glenn wrote:
date ( string format [, int timestamp] )
To turn a php timestamp into something that will be recognized by the
mysql DATE type, you might try this:
$due_date= //however you set up you invoice+14days timestamp
$mysql_date = date("Y-m-d",$due_date);// makes a string like YYYY-MM-DD
The php date() function can form just about any string you want to make
from a date if you've got a timestamp, which you do.
What formate is your original date in? There may be an even simpler way of
Ruprecht Helms wrote:
how can I calculate the due date from the date of an invoice and
insert the result into a mysql-database. The daydifference is 14 days.
Actualy I have tried something with mktimes, but I only get the timestamp
of the due date. I have troubles to write that into a dabasefield that
was set to datetype.
And to add to the discussion, why would you want to do such a thing?
Calculate it when retrieving the data. It's similar to storing a person's
age when you have the date of birth.
Regards - Miles Thompson
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.371 / Virus Database: 267.14.12/220 - Release Date: 1/3/2006
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php