blasterstudios
Technical User
Hey. I'm using dreamweaver and i found this calendar popup thing that allows me to select a day out of the year and it inserts it into my form.
It puts it into the format "2005-02-01". I store all my dates in mySQL database in the Unix timestamp format. The question is, how do I convert the date in that field to Unix timestamp before it is updated in the table?
This is the part of my code that dreamweaver uses to update the table row:
The 2 inside the arrows (--> <--) are the ones i need to convert to timestamp. I'm assuming it involves:
1: attaching a time to the datestamp (12pm Noon will be fine for all of them)
2: convert the variable into timestamp using something like
$orderdate = date("U",$orderdate);
3: putting that value into this update query.
I'm just not sure how to do that.
It puts it into the format "2005-02-01". I store all my dates in mySQL database in the Unix timestamp format. The question is, how do I convert the date in that field to Unix timestamp before it is updated in the table?
This is the part of my code that dreamweaver uses to update the table row:
Code:
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE invoices SET invoicetype=%s, customerid=%s, terms=%s, orderdate=%s, completiondate=%s, status=%s, paidinfull=%s, notes=%s WHERE invoiceid=%s",
GetSQLValueString($_POST['invoicetype'], "text"),
GetSQLValueString($_POST['customerid'], "int"),
GetSQLValueString($_POST['terms'], "text"),
-->GetSQLValueString($_POST['orderdate'], "int"),
GetSQLValueString($_POST['completiondate'], "int"),<--
GetSQLValueString($_POST['status'], "text"),
GetSQLValueString($_POST['paidinfull'], "int"),
GetSQLValueString($_POST['editnotes'], "text"),
GetSQLValueString($_POST['invoiceid'], "int"));
The 2 inside the arrows (--> <--) are the ones i need to convert to timestamp. I'm assuming it involves:
1: attaching a time to the datestamp (12pm Noon will be fine for all of them)
2: convert the variable into timestamp using something like
$orderdate = date("U",$orderdate);
3: putting that value into this update query.
I'm just not sure how to do that.