Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-12-2005, 08:00 AM
AndyChamp
Guest
 
Posts: n/a
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?
Reply With Quote
  #2  
Old 05-12-2005, 09:34 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
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
Reply With Quote
  #3  
Old 05-12-2005, 09:47 AM
AndyChamp
Guest
 
Posts: n/a
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?
Reply With Quote
  #4  
Old 05-12-2005, 09:52 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
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.
Reply With Quote
  #5  
Old 05-12-2005, 10:52 AM
AndyChamp
Guest
 
Posts: n/a
Thumbs up

That's it, thanks very much!

(I knew there was a good reason why I never use VB)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 04:20 PM.


Copyright © 1999-2023 Kinook Software, Inc.