Time Entry Issue using a Table Component Ver. 7.94

I have a table component our operators use to enter in their end of shift totals.
They sometimes need to change either the start Time or end time. These are automatically stored as DateTime in this MySQL database. On the Table component these columns are displayed only as HH:mm in the db table they are “yyyy-MM-dd HH:mm:ss”. When they make a change the db table is updated as “1970-01-01 HH:mm:ss”. How do I get this Table Component chnage to update my db table with the correct date instead of the default 1970-01-01?

I am currently using the Table Component Scripting cellEdited to update these entries.
Script is below.

row = event.row
col = event.column
colName = event.source.data.getColumnName(col)
value = event.newValue
ndx = event.source.data.getValueAt(row,0)
query = "Update canfill SET %s = ? WHERE ndx = ?"
system.db.runPrepUpdate(query % colName, [value,ndx], 'history')

Something like this?

value = system.date.setTime(system.date.now(), 
	system.date.getHour24(event.newValue),
	system.date.getMinute(event.newValue),
	system.date.getSecond(event.newValue))
1 Like

Thank you PGriffith.
Below is my final scripting.

row = event.row
col = event.column
colName = event.source.data.getColumnName(col)
ndx=event.source.data.getValueAt(row,0)

    if colName == 'StartTime':
	    value = system.date.setTime(system.date.now(),
		    system.date.getHour24(event.newValue),
		    system.date.getMinute(event.newValue),
		    system.date.getSecond(event.newValue))
	    query = "Update canfill SET %s = ? WHERE ndx = ?"
	    system.db.runPrepUpdate(query % colName, [value, ndx], 'history')
    elif colName == 'StopTime':
	    value = system.date.setTime(system.date.now(),
		    system.date.getHour24(event.newValue),
		    system.date.getMinute(event.newValue),
		    system.date.getSecond(event.newValue))
	    query = "Update canfill SET %s = ? WHERE ndx = ?"
	    system.db.runPrepUpdate(query % colName, [value, ndx], 'history')
    else:
	    value = event.newValue
	    query = "Update canfill SET %s = ? WHERE ndx = ?"
	    system.db.runPrepUpdate(query % colName, [value, ndx], 'history')

Blockquote