Einzelnen Beitrag anzeigen

nahpets
(Gast)

n/a Beiträge
 
#3

AW: Zeit aus dem Netzwerk/Internet abfragen TIdSNTP

  Alt 10. Mär 2016, 15:58
Delphi 7 liefert mir hiermit die korrekte Uhrzeit:
Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
begin
  idsntp1.host := 'ptbtime1.ptb.de';
  showMessage(DateTimeToStr(idsntp1.DateTime) + #13
+ ShortDateFormat + #13
+ LongTimeFormat);
end;
Der Quelltext zu DateTimeToStr enthält folgenden Kommentar:
Delphi-Quellcode:
{ DateTimeToStr converts the given date and time to a string. The resulting
  string consists of a date and time formatted using the ShortDateFormat and
  LongTimeFormat global variables. Time information is included in the
  resulting string only if the fractional part of the given date and time
  value is non-zero. }


function DateTimeToStr(const DateTime: TDateTime): string; overload;
function DateTimeToStr(const DateTime: TDateTime;
  const FormatSettings: TFormatSettings): string; overload;
Versuch es bitte mal mit der zweiten Variante und/oder überprüfe ShortDateFormat und LongTimeFormat, ob da eventuell was drinne steht, was einer korrekten Konvertierung im Wege stehen könnte.
  Mit Zitat antworten Zitat