Forum > Win32/64

DateTime

<< < (2/2)

BobDog:

This works in Windows:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- Uses sysutils; procedure savefile(s:ansistring ;filename:ansistring);        var        f:textfile;        begin        AssignFile(f,filename);        Rewrite(f);        writeln(f,s);        closefile(f);        end;         procedure replacechar(var s:ansistring;replace:char;withthis:char);        var        n:int32;        begin          for n:=1 to length(s) do if (s[n]=replace) then s[n]:=withthis;        end;  var filename:ansistring; Begin  filename:= DateTimeToStr(now)+'.xlsx';  replacechar(filename,':','.');  replacechar(filename,'/','-');  writeln('filename = ',filename);  savefile('Hello',filename);  writeln(fileexists(filename));   deletefile(filename);  writeln(fileexists(filename));  readln;End.

PascalDragon:

--- Quote from: CCRDude on September 22, 2021, 04:53:34 pm ---The ":" is not allowed as part of the filename e.g. on Windows. It's only allowed in second place of a complete path, right after the drive letter (on Windows).
--- End quote ---

And for alternate data streams on file systems that support them (NTFS and ReFS): C:\whatever\myfile.txt:myADS ;)

seghele0:
This works fine in Windows10 and in Linux with 'Wine':

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    varFilename := 'Wiezen-'+FormatDateTime('yyyy-mm-dd__hh.mm', now)+'.xlsx';    varWorkbook.WriteToFile(varFilename, sfOOXML, true);[/code]
or

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    varFilename := 'Wiezen-'+FormatDateTime('dd-mm-yyyy__hh.mm', now)+'.xlsx';
Thanks for the support.
 :)

Navigation

[0] Message Index

[*] Previous page

Go to full version