Re: [PHP-DB] inserting due date into database
At 08:34 AM 1/4/2006, Amos Glenn wrote: php.net says: 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: 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 doing it. -Amos Ruprecht Helms wrote: Hi, 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. Regards, Ruprecht 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
Re: [PHP-DB] inserting due date into database
php.net says: 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: 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 doing it. -Amos Ruprecht Helms wrote: Hi, 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. Regards, Ruprecht -- Amos Glenn amos+amosglenn.com www.amosglenn.com 299 Le Roi Road Pittsburgh, PA 15208 There are 10 kinds of people in the world: those who understand binary and those who don't. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] inserting due date into database
On Wed, 4 Jan 2006 07:37, Ruprecht Helms wrote: > Hi, > > 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. > > Regards, > Ruprecht You don't say what format the date is presented, but you could probably look at doing the calculation with mysql's DATE_ADD; see http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html for more information. Cheers -- David Robley Don't be a sexist, broads hate that. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php