unit dateform; {$mode objfpc}{$H+} interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ButtonPanel, Spin, StdCtrls, dateUtils; type TDForm = class(TForm) ButtonPanel1: TButtonPanel; LDay: TLabel; LMonth: TLabel; LYear: TLabel; seYear: TSpinEdit; seDay: TSpinEdit; seMonth: TSpinEdit; private public end; function GetDate(var dt: TDateTime): boolean; var dForm: TDForm; implementation function GetDate(var dt: TDateTime): boolean; var frm: TDForm; d, m, y: word; begin frm := TDForm.Create(nil); try if dt = 0 then dt := Now; DecodeDate(dt, y, m, d); frm.seYear.Value := y; frm.seMonth.Value := m; frm.seDay.Value := d; if (frm.ShowModal = mrOK) then begin y := frm.seYear.Value; m := frm.seMonth.Value; d := frm.seDay.Value; case IsValidDate(y, m, d) of False: Result := False; else dt := EncodeDate(y, m, d); Result := True; end; end else Result := False; finally frm.Free; end; end; {$R *.lfm} { TDForm } end.