date string in logfile

Hi All,

I want to have a date - time in my Logfile but the colon is an illegal character.
Is there another way to get the date time in a logfile?

on Write_Log(logpath, filename, file_creation_date)
	set The_Log to logpath & "log" & (current date) as string)) &."txt"

Thanks in advance

Hi,

hm, do you mix up the file name and the contents of the file?
I think for the file name probably some “myGreatLog.log” is sufficient,
but if you really want the whole date and time string in the file name, replace the colons with something else like underline characters

Hi Stefan,

I need a date and time string.
How do I replace the colon when using: set The_Log to logpath & “log” & (current date) as string)) &.“txt”

Regards,
Peter

something like this?


set The_Log to logpath & "log" & (date string of (current date)) & "_" & (do shell script "/bin/date +%H%M%S" & ".txt")

Thanks,

It Works!!