Einzelnen Beitrag anzeigen

TiGü

Registriert seit: 6. Apr 2011
Ort: Berlin
3.062 Beiträge
 
Delphi 10.4 Sydney
 
#16

AW: Datumsformat (TT.MM.JJJJ) anzeigen

  Alt 8. Jun 2018, 10:25
Schluss mit rumraten, Zeit für die Windows API:

Delphi-Quellcode:
var
  lpLocaleName: PWideChar; LLCType: LCTYPE;
  lpLCData: PWideChar; cchData, ReturnValue: Integer;
  DataValue: TArray<WideChar>;
begin
  lpLocaleName := PChar(LOCALE_NAME_SYSTEM_DEFAULT);
  LLCType := LOCALE_SSHORTDATE;
  lpLCData := nil;
  cchData := 0;
  cchData := GetLocaleInfoEx(lpLocaleName, LLCType, lpLCData, cchData);

  if cchData = 0 then
    RaiseLastOSError
  else
  begin
    SetLength(DataValue, cchData);
    lpLCData := @DataValue[0];
    cchData := GetLocaleInfoEx(lpLocaleName, LLCType, lpLCData, cchData);
  end;

  ShowMessage(string(DataValue));
end;
  Mit Zitat antworten Zitat