PDA

View Full Version : Date time format issue


teognost
03-19-2009, 04:40 AM
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.

kinook
03-19-2009, 12:35 PM
I suspect that the Windows system locale or the user locale for the user the task is running under needs to be configured to use the desired date format. You would need to contact Microsoft regarding that. You can exclude VBP from the equation by scheduling a .bat file containing:
date /t >c:\test.log

teognost
03-20-2009, 04:29 AM
I did some research-it seems during the install of OS -regional options were set to Czech Republic.Although I set this differently later for the related users-system still used this Cz settings when launching sch task.
However -I found some workaround -I have set Language and Regional options to ‘English US’-> and then Ticked the checkbox in Advanced ‘Apply all settings to the current user accoount and to the default user profile’.After I did this -the correct date format was used when launching Sch task for VBP project.