Archive: how to get the date and time?


how to get the date and time?
Does NSIS have a way to get the current date and/or time? I want to create a file whose name includes the date plus time so other similar files doen't get overwritten. Or is there a "random" function so I can generate a unique name?
thanks


http://nsis.sourceforge.net/Docs/AppendixE.html#E.1.6


Originally posted by Red Wine
http://nsis.sourceforge.net/Docs/AppendixE.html#E.1.6
Many thanks!

Oops -- I'm too ignorant to use this!

I added '!include "FileFunc.nsh"' (and the headerfile is being found ok) and copy-pasted the example code "${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6", but at compile time that's rejected with "Invalid command: ${GetTime}". (I tried both in a section by itself and in one of my sections.)

Is there magic sauce which I'm missing?

To generate a random filename at runtime use GetTempFileName. To generate a random filename at compile time use !tempfile.

To generate a string including a date or time in compile time, use !define /date.

!define /date TIMESTAMP "%x %X"

"Invalid command: ${GetTime}".
!include FileFunc.nsh
!insertmacro GetTime

Originally posted by Red Wine
!include FileFunc.nsh
!insertmacro GetTime
Appreciated! It's good now, thanks, and i've learned a bit more!

Originally posted by kichik
To generate a random filename at runtime use GetTempFileName. To generate a random filename at compile time use !tempfile.

To generate a string including a date or time in compile time, use !define /date.
!define /date TIMESTAMP "%x %X"
Thanks! useful! For now GetTime is what I need, but this gets me further up the learning-curve.

Hmm ... stuck again!

How is "${GetTime}" used in an uninstall section?

tia


!include FileFunc.nsh
!insertmacro un.GetTime
........
${un.GetTime}....


thanks again!