Re: inserting due date into database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:

<?php
$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 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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux