system.print.printToImage with date name

Hi, I have this code in a button and I’m trying to give the image a name using the currentdatetime tag, but I don’t know how to put it correctly.

Date = system.tag.getTagValue("[System]Gateway/CurrentDateTime") 
system.print.printToImage(event.source.parent, "Date + '.jpg'")

Hi MoisesZV


Date = str(system.tag.getTagValue("[System]Gateway/CurrentDateTime")) Date = Date.replace(":"," ") system.print.printToImage(event.source.parent, Date + '.jpg')

first I turned the date into a string,
then removed the “:” as they won’t be liked in a file name.
then removed the “” around Date as its a string already.