Показать сообщение отдельно
  #2  
Старый 18.11.2015, 19:58
Аватар для Страдалецъ
Страдалецъ Страдалецъ вне форума
Гуру
 
Регистрация: 09.03.2009
Адрес: На курорте, из окна вижу теплое Баренцево море. Бррр.
Сообщения: 4,721
Репутация: 52347
По умолчанию

Ну вот вам извращение с датой:
Код:
type
  TDateRec = record
   Date: Array[0..2] of String;
  private
   function GetDate(const Index: Integer): String;
  public
   property Day: String index 0 read GetDate;
   property Month: String index 1 read GetDate;
   property Year: String index 2 read GetDate;
  end;

  TForm8 = class(TForm)
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form8: TForm8;

implementation

{$R *.dfm}

procedure TForm8.Timer1Timer(Sender: TObject);
Var DateRec: TDateRec;
begin
 Caption := DateRec.Day + '.' + DateRec.Month + '.'+ DateRec.Year;
end;

{ TDate }

function TDateRec.GetDate(const Index: Integer): String;
Var FS: TFormatSettings;
begin
 FS.ShortDateFormat := 'ddmmyyyy';
 case Index
 of 0: Result := Copy(DateToStr(Now, FS), 1, 2);
    1: Result := Copy(DateToStr(Now, FS), 3, 2);
    2: Result := Copy(DateToStr(Now, FS), 5, 4);
 end;
end;
__________________
Жизнь такова какова она есть и больше никакова.
Помогаю за спасибо.
Ответить с цитированием