How can I add a timestamp to a filename (for logging purposes)? [SOLVED] lazarus / 21-General ---------------------------------------------------------------------- AMJF · 2025-06-06 16:01 How can I use a formatted Windows timestamp using the system clock to put the date and time, even seconds, into the start of a filename for a logging system? I'd like an example filename to be something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i C:\Logs\2025.06.06 16.58.34 Log 1.txt If I could use the function to format the date/time this way, the better. ---------------------------------------------------------------------- Fibonacci · 2025-06-06 16:11 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses SysUtils; var  s: string; begin  DateTimeToString(s, 'yyyy.mm.dd hh.mm.ss', Now);  s := 'C:\Logs\'+s+' Log 1.txt';  writeln(s);  readln;end. ---------------------------------------------------------------------- AMJF · 2025-06-06 18:28 Brilliant! Thx very much! ---------------------------------------------------------------------- CM630 · 2025-06-06 21:09 Quote from: Fibonacci on June 06, 2025, 06:11:47 pm...   DateTimeToString(s, 'yyyy.mm.dd hh.mm.ss', Now); ...I think it shall be yyyy.mm.dd hh.nn.ss ---------------------------------------------------------------------- Fibonacci · 2025-06-07 09:04 If the previous token is "H" then "M" means minutes, otherwise its month. But I agree, using "N" for minutes avoids ambiguity.