Wise Script Editor - comparing dates (Full Version)

All Forums >> [Scripting Technologies] >> Wise Solutions



Message


skrummen -> Wise Script Editor - comparing dates (4/16/2008 12:59:25 PM)

I am looking for Wise script editor code that will compare two dates.

Example:
File Modified date = 03/13/08
compare to date = 01/18/08

I want to be able to compare the 2 dates and have Wise Script Editor know that 01/18/08 is greater (older) than 03/13/08.

I tried parsing the variables and changing the format to YY/MM/DD and then comparing the variables but now it appears the month isn't calculating correctly since 03 is greater than 01.

Any help would be appriciated.




skrummen -> RE: Wise Script Editor - comparing dates (4/16/2008 4:02:39 PM)

I think I figured this out.

I ended up creating a .vbs file that is called from the script that takes variables from the wise script, executes the vbs script and then brings the result back to wise again.

vbs code:

'(Declarations) 
FILEMOD = GetVariable("FILEMOD")
DEATHDATE = GetVariable("DEATHDATE")
FILEMOD = CDate(FILEMOD)
DEATHDATE = CDate(DEATHDATE)
If DateDiff("d", FILEMOD, DEATHDATE) >= 1 Then
   SetVariable "DATECOMPARE", 1
Else
   SetVariable "DATECOMPARE", 0
End If
'End of (Declarations)




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.1875