generate filename with sysdate and time

bartjev

New Member
HI,

I am trying to make a program with the progress procedure editor.
With this file I want to generate output from progress to a text file.

I want to give te textfilename this format: ART[DATE][TIME].txt
Date format: YYYYMMDD and time HHMMSS. The time and date should be te system time and time when the textfile was created.
Altogether: ARTYYYYMMDDHHMMSS.txt

I tried several things:
Code:
def var bestandsnaam as character no-undo. 
assign bestandsnaam = "c:\temp\" + "ART" + STRING(DATE, 'YYYYMMDD') 
+ STRING(TIME, 'HHMMSS') + ".txt".
But i get this error:
DATE matches multiple fields in PART. (3509)
The partial field name DATE matches multiple field names in the named table. You did not give the Compiler enough information. Specify the field name more precisely.

Any Ideas?
thnx in advance!
 

bartjev

New Member
Code:
assign bestandsnaam = "c:\temp\" + "ART" + STRING(Today) + 
STRING(TIME, 'HH:MM:SS') + ".txt".

Ok thanx.

But my next problem is that now this statement wants to create this filename:
C:\temp\ART28/10/0412:52:59.txt

This is invalid because of the : and / in the filename. Does anybody now how to ged rid of them?
 

bartjev

New Member
Got it!

Code:
assign bestandsnaam = "c:\temp\" + "ART" + REPLACE(STRING(Today), "/","") 
+ REPLACE(STRING(TIME, "HH:MM:SS"), ":", "") + ".txt".

Oh yeah just one more thing: does anybody know how to change te Today format from ddmmyy to yyyymmdd??

Thnx
 

samu fish

New Member
year first

You can do
Code:
SUBSTITUTE('&1&2&3', YEAR(d), STRING( MONTH(d),'99'), STRING( DAY(d),'99') )
which will output yyyymmdd

Replace d with today or what ever date variable you want.
 
Top