MS sql. How to update the time in a Datetime lazarus / 16-Databases ---------------------------------------------------------------------- SteenJorgensen · 2018-12-08 09:41 How to update the time only in a datetime. I miss a function eg.: myfielddatetime = SETTIME([myfielddatetime], '20:16') Are there any hint? ---------------------------------------------------------------------- Zvoni · 2018-12-08 11:07 To clear it up: You have a datetime-field already (!!) containing a date (e.g. Dec. 7th 2018) and now you want to ADD a Time (say 20:16)? Curious if you'll see my hint..... ---------------------------------------------------------------------- lucamar · 2018-12-08 12:36 Quote from: SteenJorgensen on December 08, 2018, 10:41:04 amHow to update the time only in a datetime. I miss a function eg.: myfielddatetime = SETTIME([myfielddatetime], '20:16') Are there any hint? Well, there is something similar in dateutils: RecodeTime() Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i MyDataSet.FieldByName['MyDate'].AsDateTime := RecodeTime(    MyDataSet.FieldByName['MyDate'].AsDateTime,    NewHour, NewMinutes, NewSeconds, NewMilliseconds); or maybe like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var ADateTime: TDateTime; {. . .}   ADateTime := MyDataSet.FieldByName['MyDate'].AsDateTime;  ADateTime := RecodeTime(    ADateTime,NewHour, NewMinutes, NewSeconds, NewMilliseconds);  MyDataSet.FieldByName['MyDate'].AsDateTime := ADateTime; or if you insist on using a string: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  ADateTime: TDateTime;  ATime: TDateTime;  dd, mm, yy,  hh, mn, ss, ms: word;begin{. . .}  { Get date from the field }  ADateTime := MyDataSet.FieldByName['MyDate'].AsDateTime;   { Get the needed time vars from time string}  ATime := StrToTime('20:16');  DecodeDateTime(ATime, yy, mm, dd, hh, mn, ss, ms);   { Recode the date with the new time }  ADateTime := RecodeTime(    ADateTime,NewHour, NewMinutes, NewSeconds, NewMilliseconds);   { And set the field with the new value }  MyDataSet.FieldByName['MyDate'].AsDateTime := ADateTime;end; You get the drift, I hope