VB Scripts

eNerGiZer1010

New member
Joined
Jul 5, 2004
Messages
1
Programming Experience
Beginner
G'Day Folks,

I have a script that I want to use with SQL Server. What I want the script to do is run a query in in sql for the current date time as star date time and current date time -24 hours for end date time. The script is supposed to run daily reports taking bd for the past 24 hours.

My problem is that i'm not sure what to write in the script to set the start date time as (windows current time) and the end date time as (windows current time - 24 hours).

Here is the script:
if StartDateTime = "" then
Prompt1 = "Enter the start date for the report." & vbcrlf & "Format: yyyy-mm-dd HH:mm:ss"
StartDateTime = InputBox(Prompt1,"Report Start Date" , DefaultStartDateTime)
if len(startDateTime) = 0 then
'User click on Cancel
Wscript.Echo "Report Generation has been cancelled."
Wscript.Quit
End If
end if

if EndDateTime = "" then
Prompt2 = "Enter the End date for the report." & vbcrlf & "Format: yyyy-mm-dd HH:mm:ss"
EndDateTime = InputBox(Prompt2,"Report End Date" , DefaultEndDateTime)
if len(EndDateTime) = 0 then
'User click on Cancel
Wscript.Echo "Report Generation has been cancelled."
Wscript.Quit
End If
end if


From my understanding I will need to write a function so that start date time = windows current date time and that end date time = windows current date time - 24 hours.

P.S. Is the format of the date time in windows the same as the format of the script because that could be a problem?

Thanks for all the help.

Your's truly.
 
Back
Top