Be very careful with this code, especially the " first" INSERT (inserting Time by calling DateTime-Function)or from app:
INSERT INTO godziny (MiesiacID, Czas_rozpoczecia, Czas_zakonczenia, Uwagi) SELECT 11, datetime('now'), datetime('now'), 'test'
query.SQL.Text := ' insert into godziny (MiesiacID, Czas_rozpoczecia, Czas_zakonczenia, Uwagi) values (:mid, :cod, :cdo, :uw) '; query.ParamByName('mid').AsInteger := iMiesiacID; query.ParamByName('cod').AsDateTime := Now; query.ParamByName('cdo').AsDateTime := Now; query.ParamByName('uw').AsString := 'test'; query.ExecSQL;
I do not use the system time, I choose the time from the TimeEdit componentYour point?
In Windows, a datetime is a float, with the integer part being the date and the fractional part being the time. There are 32 and 64 bit variants. You can do math with those.Close. Though, this only applies to SQLite.
You also have Unix time, the amount of seconds from a start date (often, 1970-01-01). It (fortunately) ignores leap seconds. 32 and 64 bit variants. Usable for math as well.
Another option is the ISO DateTime: a string as Zvoni said. This is the most portable and only readable format, but you cannot do math with it.
So, the best way to store it in an SQLite database is as an ISO string. But if you want to do math with it, you have to convert it to a datetime first. You can do that in SQLite or in Free Pascal. If you want to do math to it directly, Unix time is your best bet.
Free Pascal / Lazarus uses the float format.
I read these documentation neither TimeEdit.Text nor TimeEdit.Time does not insert time only 1.9E3Because „1.9E3“ IS a real value.
Thank you very much for all the answers.Just keep in mind the right order to store a date and time in a database. That is critical and I have no sign from you that you actually now know why?