Code File:
unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) listbox1: tlistbox; button1: tbutton; button2: tbutton; Procedure button1click (Sender: tobject); Procedure button2click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} procedure tform1.button1click (Sender: tobject); var D: tdate; T: tTime; begin D: = encodedate (2008, 9, 11); T: = encodetime (14, 56, 12, 1); listbox1.clear; listbox1.items. add (formatdatetime ('yyyy/MM/dd', D); listbox1.items. add (formatdatetime ('hh: NN: SS: zzz', t); end; Procedure tform1.button2click (Sender: tobject); var D: tdate; T: tTime; DT: tdatetime; begin D: = strtodate ('2017-9-11 '); T: = strtotime ('14: 56: 06'); DT: = strtodatetime ('2017-9-11 14:56:06 '); listbox1.clear; listbox1.items. add (datetostr (d); listbox1.items. add (timetostr (t); listbox1.items. add (datetimetostr (DT); end.
Form file:
Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 93 clientwidth = 249 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false pixelsperinch = 96 textheight = 13 object button1: tbutton left = 158 Top = 14 width = 75 Height = 25 caption = 'button1' taborder = 0 onclick = button1click end object listbox1: tlistbox left = 0 Top = 0 width = 145 Height = 93 align = alleft itemheight = 13 taborder = 1 explicitheight = 206 end object button2: tbutton left = 158 Top = 53 width = 75 Height = 25 caption = 'button2' taborder = 2 onclick = button2click endend