简体   繁体   中英

How to set a specific timezone for windows CE By C#

hi everyone i need to make the time zone for my windows CE 6 changed to "(GMT +03:00) Kuwait, Riyadh" and this my code

[DllImport("coredll.dll", CharSet = CharSet.Auto)]

private static extern int GetTimeZoneInformation(out TimeZoneInformation lpTimeZoneInformation);



[DllImport("coredll.dll", CharSet = CharSet.Auto)]

private static extern bool SetTimeZoneInformation(ref TimeZoneInformation lpTimeZoneInformation);



[StructLayout(LayoutKind.Sequential)]

public struct SYSTEMTIME
{

    public int wYear;

    public int wMonth;

    public int wDayOfWeek;

    public int wDay;

    public int wHour;

    public int wMinute;

    public int wSecond;

    public int wMilliseconds;

}



[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]

public struct TimeZoneInformation
{

    public int bias;

    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]

    public string standardName;

    public SYSTEMTIME standardDate;

    public int standardBias;

    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]

    public string daylightName;

    public SYSTEMTIME daylightDate;

    public int daylightBias;

}

how can I use this code to set the time zone for the specific one please any one can help me.

I found the solution by adding a registry file with this script.

[HKEY_LOCAL_MACHINE\Time Zones]
        "Default"="Arab Standard Time" 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM