System.Time.getLocalTime method

[ The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]

Gets the system time for a specific time zone.

Syntax

strRetVal = System.Time.getLocalTime(
  oTimeZone
)

Parameters

oTimeZone [in]

System.Time.timeZone that specifies the desired time zone offset.

Return value

The system time, adjusted for time zone offset, as a String.

Remarks

Each System.Time.timeZone in the timeZones collection corresponds to the system time zones itemized in the Time Zone Settings dialog.

The following image shows the Time Zone Settings dialog.

time zone settings dialog

Examples

The following example demonstrates how to get the local time based on a selected time zone.

var oSelectedTimeZone = System.Time.currentTimeZone;
    
// --------------------------------------------------------------------
// Display the system time based on selected time zone.
// --------------------------------------------------------------------
function DisplayTime()
{
    // Retrieve the local time.
    var sTimeInfo = System.Time.getLocalTime(oSelectedTimeZone);
    if (sTimeInfo != "")
    {
        System.Sound.beep();
        var dDateInfo = new Date(Date.parse(sTimeInfo));   
        tHours = dDateInfo.getHours();
        tMinutes = dDateInfo.getMinutes();
        tMinutes = ((tMinutes < 10) ? ":0" : ":") + tMinutes
        tSeconds = dDateInfo.getSeconds();
        tSeconds = ((tSeconds < 10) ? ":0" : ":") + tSeconds;
        return tHours + tMinutes + tSeconds;
    }
    else
    {
        // Display default text.
    }
}

Requirements

Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
End of client support
Windows 7
End of server support
Windows Server 2008
Header
Sysinfoapi.h
IDL
Sidebar.idl
DLL
Sidebar.Exe (version 1.00 or later)

See also

Reference

System.Time

currentTimeZone

timeZones

System.Time.timeZone

bias

displayName

DSTBias

DSTDate

DSTDisplayName

name

standardBias

standardDate

standardDisplayName