Format "0001" IntToStr
Hallo,
möchte das aktuelle Datum + eine fortlaufende Zahl anzeigen lassen. Anzeige Beispiel: 1506010001 Lasse ich das "(Format('%.3d')" weg wird der Text so angezeigt: 1506011! Das Ziel ist aber:" 0001" (1506010001) Was ist hier falsch?
Delphi-Quellcode:
ShowMessage((FormatDateTime('yymmdd',now))+(Format('%.3d',[IntToStr(zaehler)])));
inc(zaehler); |
AW: Format "0001" IntToStr
Zitat:
Ich habe es oben schon einmal geändert. |
AW: Format "0001" IntToStr
Danke
|
AW: Format "0001" IntToStr
Eine maximal 3-stellige Zahl?Siehe dein Formatstring, oder doch eine 4-stellige?
Man kann natürlich auch die Feinheiten von nur einer der beiden Formatfunktionen ausnutzen. :stupid: Ansonsten natürlich einfach Beides kombinieren.
Delphi-Quellcode:
Und IntToStr kann natürlich nicht funktionieren, jedenfalls nicht zusammen mit %d, denn als String ist es natürlich %s.
Format('%.2d%.2d%.2d%.3d', [YearOf(Now), MonthOf(Now), DayOf(Now), Zähler])
FormatDateTime('yymmddzzz', IncMilliSecond(DateOf(Now), Zähler)) FormatDateTime('yymmddzzz', DateOf(Now) + Zähler / MSecsPerDay) // *hust* FormatDateTime('yymmdd', Now) + Format('%.3d', [Zähler]) Format('%s%.3d', [FormatDateTime('yymmdd', Now), Zähler]) |
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:32 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz