Find Local Time Zone using VBScript in QTP


Find Local Time Zone using VBScript in QTP:

A time zone is a region of the earth that has uniform standard time, usually referred to as the local time. By convention, time zones compute their local time as an offset from UTC (see also Greenwich Mean Time). Local time is UTC plus the current time zone offset for the considered location.
(Source : http://en.wikipedia.org/wiki/Time_zone)

Here is a code to fetch the time zone of your local computer system.

Dim oWMIService, oComputer, colComputer
Dim strComputer
strComputer = “.”
Set oWMIService = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate}!\\” _
& strComputer & “\root\cimv2”)
Set colComputer = oWMIService.ExecQuery _
(“Select * from Win32_TimeZone”)
For Each oComputer in colComputer
msgbox oComputer.Description
Exit For
Next
Set oComputer = Nothing
Set colComputer = Nothing
Set oWMIService = Nothing
Time Zone

Time Zone

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: