Monday, 29 September 2008

System Date change through QTP

Many a times an automation engineer can come up with a scnerio where he needs to change the system date. So how to approach this? Following is the code snippet that i have used and it works sucessfully:

sNewDate = Date + 5
sNewDate = Cdate(sNewDate)
Dim oShell
Set oShell = CreateObject ("WSCript.shell")
oShell.run "cmd /k Date " & sNewDate & "& Exit"

No comments: