hello. i was just wondering if it is possible to insert data for date and time separately into database for a column with type datetime. datetime format is like : yyyy-mm-dd h:m:s . I know you can get date and time separately FROM database but is it possible to be inserted separately. as an example there is a form one textbox for date one textbox for time then on insert the data from the texboxes are inserted into the column(with type datetime) accordingly.

4 Years
Discussion Span
Last Post by almostbob

datetime is a stupid, woefully inefficient data construct
a timestamp uses 4 bytes, and stores all the information of a 25byte text representation datetime
not much in 1 record, a lot in 100million records
and the processing to output the data in any form, is a less, orders of magnitude less
select date > stored text date and < stored text date,
(convert str2time() for each entry)
is orders of magnitude more processor intensive than
select date > 1234567890 and < 2345678901

in answer to the actual question,

set a default value, that the data handler accepts as nul‚Č°unpopulated
or populate the unfilled fields with today's date and time
overwrite with user entered values, and store the value in the db

Edited by almostbob

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.