Topic: format date

hi ,
i like to convert the record imeragen which is a DATE variable in the format dd/mm/yyy to have it in an edit box


frmCreateProtypa.Edit21.Text:= SQLExecute('imeragen from Stoixeia WHERE id=' + IntToStr(frmCreateProtypa.TableGrid3.dbItemID));

Re: format date

Hi,
Attached is one possible way of doing it.
Derek.

Post's attachments

Attachment icon date as string.zip 337.04 kb, 186 downloads since 2022-06-17 

Re: format date

Thank you, it works perfect

4 (edited by Step-in 2023-08-17 12:49:52)

Re: format date

Don't work in real time. How to make the value in the text field change after changing the date?

P.S. I asked the question myself and I found solution:

procedure frmAddDecision_DateTimePicker1_OnChange (Sender: TObject);
begin
    frmAddDecision.Edit2.Text:= FormatDateTime('yyyy-mm-dd', frmAddDecision.DateTimePicker1.DateTime);
end;
Post's attachments

Attachment icon DB.JPG 16.04 kb, 21 downloads since 2023-08-17