Stupid question: now/current_timestamp value lazarus / 16-Databases ---------------------------------------------------------------------- xinyiman · 2019-08-22 09:31 Impara la pronuncia Hi guys, I have a very trivial question about valuing a date in a database field. I work a lot with queries and know that with firebird when I want to set the date to the current date I just need to use the current_timestamp but for a project I have to use the process MyQuery.Edit; MyQuery.FieldByName('myfield').AsDateTime  := now; MyQuery.Post; Only that now populates the value with the date of the client and not of the server. How can I solve the problem? ---------------------------------------------------------------------- rvk · 2019-08-22 10:57 Quote from: xinyiman on August 22, 2019, 11:31:55 am... but for a project I have to use the process ... Only that now populates the value with the date of the client and not of the server. How can I solve the problem? If you really need to use that exact process, you can't use current_timestamp or 'NOW'. You have two options. Change the INSERT to use current_timestamp or 'NOW'. Or retrieve current_timestamp with a separate SQL-statement from the server and fill it in with the AsDataTime. Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SELECT CURRENT_TIMESTAMP FROM rdb$database Quote from: xinyiman on August 22, 2019, 11:31:55 amOnly that now populates the value with the date of the client and not of the server. How can I solve the problem? Is the date of the client so much different from that of the server ???? ---------------------------------------------------------------------- xinyiman · 2019-08-22 11:40 I figured it was the only solution. Quote from: rvk on August 22, 2019, 12:57:30 pmIs the date of the client so much different from that of the server ???? In theory, no, but it can happen. ---------------------------------------------------------------------- valdir.marcos · 2019-08-22 16:08 Quote from: xinyiman on August 22, 2019, 11:31:55 amHi guys, I have a very trivial question about valuing a date in a database field. I work a lot with queries and know that with firebird when I want to set the date to the current date I just need to use the current_timestamp but for a project I have to use the process MyQuery.Edit; MyQuery.FieldByName('myfield').AsDateTime  := now; MyQuery.Post; Only that now populates the value with the date of the client and not of the server. How can I solve the problem?As a matter of fact, this is a problem for a sysadmin and not for software developers... https://en.wikipedia.org/wiki/Network_Time_Protocol https://www.ntppool.org/ Just consider as a silly example that your sever is in Uruguay and you have clients in England and Japan. You will be in trouble if you record local time instead of server centralized time. Quote from: rvk on August 22, 2019, 12:57:30 pmYou have two options. Change the INSERT to use current_timestamp or 'NOW'. Or retrieve current_timestamp with a separate SQL-statement from the server and fill it in with the AsDataTime.+1