|
#1
|
|||
|
|||
Accessing VB functions
I want to use VBScripts' DateDiff function to get the current day as number of days from a base date. This will be a field in our version number. However, although I can access the Year & Day functions, I can't get DateDiff. Is there aa list anywhere of which functions I can use?
|
#2
|
|||
|
|||
DateDiff is available from VBScript. The following code works in a Run Script step:
Builder.LogMessage DateDiff("d", Now, #1/1/2006#) The available VBScript functions are documented here: http://msdn.microsoft.com/library/en...riVBScript.asp |
#3
|
|||
|
|||
OK, that helps - but as a VBScript novice I'm still stuck!
The output I'm getting is now Building project step 'Increment Build number'... 234 497 Error at Line 5, Column 1 (Object required: 'DateDiff(...)') The script fragment is ' set the version number for the various features Builder.LogMessage DateDiff("d", Now, #1/1/2006#) 'Set Origin = DateValue("1/1/2004") Builder.LogMessage DateDiff("d", #1/1/2004#, Now) set ourday = DateDiff("d", #1/1/2004#, Now) It looks rather as if, despite the error complaining about DateDiff, it's some kind of type incompatibility. Any more help please? |
#4
|
|||
|
|||
Remove the set in the line
set ourday = DateDiff("d", #1/1/2004#, Now) The Set statement is used only when assigning object values (a VB-ism). DateDiff just returns a number. |
#5
|
|||
|
|||
That's it, thanks very much!
(I knew there was a good reason why I never use VB) |
Thread Tools | |
Display Modes | Rate This Thread |
|
|