View Single Post
  #1  
Old 03-19-2009, 05:40 AM
teognost teognost is online now
Registered User
 
Join Date: 05-25-2004
Location: Prague,Czech Republic
Posts: 182
Date time format issue

I am moving all the builds to a new box,I have set regional and language options to English US .Short date format is :M/d/yyyy
and date separator is /.I have done this for my user and for the user used to launch scheduled tasks also.
However when the buils scheduled task is started-the date time in log appear in a different format:
//**************
18.3.2009 20:01:07: Building project step 'SET TIME_START Macro'...
Updated Project macro 'TIME_START'
18.3.2009 20:01:07: Building project step 'Log the start time'...
TIME_START is 18.3.2009 20:01:07
//**************
I set TIME_START (with a set Macro step) to %DATETIME%.
I do not understand why it appears in this format.
Later I set TIME_END also to %DATETIME%:
//***************
18.3.2009 20:13:21: Building project step 'SET TIME_END Macro'...
Updated Project macro 'TIME_END'
18.3.2009 20:13:21: Building project step 'Log the end time'...
TIME_END is 18.3.2009 20:13:21
//***************
and then the build fails when setting the time interval:
//***************
18.3.2009 20:13:21: Building project step 'set the time interval between TIME_START and TIME_END'...
Error in Run Script (VBScript) script code at Line 6, Column 1 (Type mismatch: '[string: "18.3.2009 20:13:21"]')
18.3.2009 20:13:21: Step 'set the time interval between TIME_START and TIME_END' failed
//***************
The VBScript code for this step is:
//**********
Set ts = vbld_AllMacros()("TIME_START")
Set te = vbld_AllMacros()("TIME_END")
Set ti = vbld_AllMacros()("TIME_INTERVAL")
Set svnd = vbld_AllMacros()("SVN_DURATION")

ti.Value=DateDiff("s",ts.Value,te.Value)
svnd.Value=ti.Value
Builder.LogMessage "Elapsed time for step (seconds) = " &ti.Value
//************
Any idea how to fix this error?
Normally the dates should appear like :
3/18/2009 8:01:07 PM and 3/18/2009 8:13:21 PM and this way I will not have any error when calculating the time interval.
When I open the VBP project and try to run manually these steps -everything is set correctly.Only when running from sch task I have this error.
Reply With Quote