![]() |
strftime für Delphi ?
Hallo alle schlaue,
gibt es irgendwo eine strftime() Library für Delphi ? Also, eine Funktion ähnlich in php, wo ich gleiches Formattierungsbild eingeben kann, ergebniss String.
Code:
habe soweit nichts gefunden
mystring := strftime('Heute ist %Y %m %d');
|
AW: strftime für Delphi ?
![]()
Delphi-Quellcode:
str := System.SysUtils.FormatDateTime('"Heute ist "yyyy mm dd',System.SysUtils.Now());
|
AW: strftime für Delphi ?
Danke für das Antwort. Klar kenne ich die Formatcodes von Delphi.
In dieser Fall brauche ich aber die formatcodes von strftime() zu behandeln. Ich kann das wenn notwendig selbst umsetzen. Aber hätte jemand das schon gemacht.. |
AW: strftime für Delphi ?
Liste der Anhänge anzeigen (Anzahl: 2)
Ich habe beim neusuche herausgefunden das es strftime() gibt in MSVCRT.DLL. Das würde mir reichen.
Aber : ich mache irgendwas falsch ? Gefunden habe ich das hier: ![]() Mein Code + Unit im Anhang. Ich bekomme kein Fehler beim call an _strftime(), aber auch kein ergebniss. Was mache ich falsch ? |
AW: strftime für Delphi ?
Zitat:
|
AW: strftime für Delphi ?
Zitat:
|
AW: strftime für Delphi ?
Zitat:
|
AW: strftime für Delphi ?
Zitat:
Code:
rauskommen müsste durch
Aus %%Y wird %Y
Delphi-Quellcode:
strftime
Code:
Der passende Format-String für Delphi wäre
Aus %Y wird 2019
Code:
Meine Einschätzung: Es ist einfacher den Formatstring so wie er ist zu parsen und direkt die Werte zu ersetzen als diesen erst umzuformen (da muss man auch parsen) und dann durch
"Aus %Y wird "yyyy
Delphi-Quellcode:
zu jagen.
FormatDateTime
|
AW: strftime für Delphi ?
Zitat:
EDIT: Klar, direkt parsen ist natürlich besser :) |
AW: strftime für Delphi ?
Wenn du bei
Code:
alle
Aus %%Y wird %Y
Delphi-Quellcode:
durch
%Y
Delphi-Quellcode:
ersetzt, dann erhälst du
YYYY
Code:
Du brauchst aber für die korrekte Formatierung
Aus %YYYY wird YYYY
Code:
"Aus %Y wird "YYYY
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:23 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz