Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Is date comparison possible? (http://forums.winamp.com/showthread.php?t=270763)

mrinalvora 7th May 2007 03:56

Is date comparison possible?
 
I was wondering if it is possible to compare dates in two variables in NSIS? I have searched the manual, the web and this forum with no luck.

If I have the date in two variables, for example:

; The date of the file time

${GetTime} "$WINDIR\Explorer.exe" "C" $0 $1 $2 $3 $4 $5 $6

; and the date now

!define /date NOW "%H:%M:%S %d %b, %Y"

Is is possible to compare these two to see if the date of file creation is within a certain number of days of the current date?

Wisdom in this matter will be much appreciated.

Kind Regards.

Afrow UK 7th May 2007 14:42

Rather than using !define /date NOW "%H:%M:%S %d %b, %Y", use
!define /date Day "%d"
!define /date Month "%m"
!define /date Year "%Y"
and then compare each value individually.

Stu

demiller9 7th May 2007 15:53

Quote:

Is is possible to compare these two to see if the date of file creation is within a certain number of days of the current date?
I understood this question to ask if the file date is within a certain number of days of the installation date, not the setup build date. The '!define /date' command will capture the date the setup program was created.

When I needed to see if a file was older than some desired amount (eg, a backup was not current), I created a temp file and compared the dates of the temp file and the backup file.

Don

stb 7th May 2007 16:04

If you want to get the time span between current (system) time and the time the installer was build, you can use the time plugin.

code:

!define /utcdate BUILD_TIMESTAMP "%d.%m.%Y %H:%M:%S"

# to get the installer age in days:

time::_GetLocalTimeUTC
Pop $0
time::_MathTime "day($0) - day(${BUILD_TIMESTAMP}) = day"
Pop $1


mrinalvora 8th May 2007 04:27

Thanks guys, I managed to get it done using the Time plug-in.


All times are GMT. The time now is 06:11.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.