hi,

this is probably a simple solution but nothing is coming up in searches except date and time pickers.

i basically have a datetime column in mysql database.

i have an input field for my date part and i want to create a second input field in my form to allow the keying of the time.

the thing is i want the date and the time to insert into the same column, so not sure if i need to create a hidden field that puts the 2 together so when it inserts into the database as the one datetime?

not sure of this is correct of the code for this.

hope someone can help.

many thanks

Recommended Answers

All 3 Replies

$date = $_POST['date'];
$time = $_POST['time'];
$datetime = $date ." ". $time;

thanks.

here is the code i have:

$cal_rsRenewals->setRecordset("rsRenewals");
  $cal_rsRenewals->setField("ID", "TaskID");
  $cal_rsRenewals->setField("TITLE", "Title");
  $cal_rsRenewals->setField("DESCRIPTION", "NPW");
  $cal_rsRenewals->setField("START_DATE", "DueDate");
  $cal_rsRenewals->setField("END_DATE", "DueDate");

I want the START_DATE to be the DueDate and the TimeToCall column.

i tried adding in:

$cal_rsRenewals->setField("START_DATE", "DueDate", "TimeToCall");

but no joy.

the code you gave me, how could i impliement into my existing insert into table code:

// Add columns
$ins_tasks->setTable("tasks");
$ins_tasks->addColumn("TaskTitle", "STRING_TYPE", "POST", "TaskTitle");
$ins_tasks->addColumn("TaskType", "STRING_TYPE", "POST", "TaskType");
$ins_tasks->addColumn("Urgent", "CHECKBOX_YN_TYPE", "POST", "Urgent", "N");
$ins_tasks->addColumn("clients_ClientID", "NUMERIC_TYPE", "POST", "clients_ClientID");
$ins_tasks->addColumn("ProductAssociated", "STRING_TYPE", "POST", "ProductAssociated");
$ins_tasks->addColumn("TaskDescription", "STRING_TYPE", "POST", "TaskDescription");
$ins_tasks->addColumn("FurtherAction", "STRING_TYPE", "POST", "FurtherAction");
$ins_tasks->addColumn("Documents_DocID", "NUMERIC_TYPE", "POST", "Documents_DocID");
$ins_tasks->addColumn("Tasks_UserID", "NUMERIC_TYPE", "POST", "Tasks_UserID");
$ins_tasks->addColumn("Task_AddedByUserID", "NUMERIC_TYPE", "POST", "Task_AddedByUserID");
$ins_tasks->addColumn("TaskDueDate", "DATE_TYPE", "POST", "TaskDueDate");
$ins_tasks->addColumn("TimeToCall", "DATE_TYPE", "POST", "TimeToCall");
$ins_tasks->addColumn("Completed", "STRING_TYPE", "POST", "Completed");
$ins_tasks->setPrimaryKey("TaskID", "NUMERIC_TYPE");

thanks again

its ok i have managed to resolve by including a date and time picker in one as i was struggling to get finished.

if you could provide with anyway though for future reference i woudl appreciate.

many thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.