简体   繁体   中英

How to set time zone to frecnh zone + windows ce

I need to set my timezone in my mobile device to french zone in c# (windows embedded ce)

how can I do this please?

You can use this library to ease your development: https://opennetcf.codeplex.com/

I'm using it and setting the time zone through the following objects: TimeZoneCollection, TimeZoneInformation, DateTimeHelper.

You can not set the TimeZone to a city/location, you can only set the DST data.

See my post here: http://community.intermec.com/t5/Device-Management/change-Time-Zone-with-xml/mp/17007/highlight/true#M1023

============================================================ You can not set the name of a TimeZone using the registry!

You only can set the Offset and DST values. The clock panel then uses a matching entry.

In the registry, the values for "GMT-7 (Mountain US)" and "GMT-7 (Arizona)" are nearly the same

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Clock] "AppInfo"=hex(3):01,00,00,00,80,01,00,00,0f,00,00,00,00,00,00,00,00,00,00,00,3a,01,00,00,69,00,00,00,00,00,00,00,01,00,00,00 "AppState"=hex(3):11 "AutoDST"=dword:00000000 "GMT_OFFSET"=dword:000001A4 "HomeDST"=dword:00000000 "NetworkTimeNotifyUser"=dword:00000001 "NetworkTimeSync"=dword:00000001 "TZIndex"=dword:00000004

(see also http://peterfoot.net/HomeAndVisitingClocksInProfessionalEdition.aspx )

and

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Clock] "AppInfo"=hex(3):01,00,00,00,80,01,00,00,0a,00,00,00,00,00,00,00,01,00,00,00,3a,01,00,00,69,00,00,00,00,00,00,00,01,00,00,00 "AppState"=hex(3):11 "AutoDST"=dword:00000000 "GMT_OFFSET"=dword:000001A4 "HomeDST"=dword:00000001 "NetworkTimeNotifyUser"=dword:00000001 "NetworkTimeSync"=dword:00000001 "TZIndex"=dword:00000004

But, as you can see, there is no Name String of the time zone.

[HKEY_LOCAL_MACHINE\\Time] "TimeZoneInformation"=hex(3):a4,01,00,00,55,00,53,00,20,00,4d,00,6f,00,75,00,6e,00,74,00,61,00,69,00,6e,00,20,00,53,00,74,00,61,00,6e,00,64,00,61,00,72,00,64,00,20,00,54,00,69,00,6d,00,65,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,55,00,53,00,20,00,4d,00,6f,00,75,00,6e,00,74,00,61,00,69,00,6e,00,20,00,44,00,61,00,79,00,6c,00,69,00,67,00,68,00,74,00,20,00,54,00,69,00,6d,00,65,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,c4,ff,ff,ff

and

[HKEY_LOCAL_MACHINE\\Time] "TimeZoneInformation"=hex(3):a4,01,00,00,4d,00,6f,00,75,00,6e,00,74,00,61,00,69,00,6e,00,20,00,53,00,74,00,61,00,6e,00,64,00,61,00,72,00,64,00,20,00,54,00,69,00,6d,00,65,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0b,00,00,00,01,00,02,00,00,00,00,00,00,00,00,00,00,00,4d,00,6f,00,75,00,6e,00,74,00,61,00,69,00,6e,00,20,00,44,00,61,00,79,00,6c,00,69,00,67,00,68,00,74,00,20,00,54,00,69,00,6d,00,65,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,02,00,02,00,00,00,00,00,00,00,c4,ff,ff,ff

These are the TimeZoneInformations (the TIME_ZONE_INFORMATION structure).

Clipboard02.gif

You may query the timezone city db as done in the attached file (TZ-cities.txt).

The attached tool (timezoneset.exe) can be used to change the offset of the current active timezone.

The time zone informations for Prague and Berlin are the same:

index: 95 short name: GMT+1 Prague,Budapest name: Central Europe Standard Time GMT offset: -60 dst name: Central Europe Daylight Time DST offset: 0 ...

index: 110 short name: GMT+1 Berlin,Rome name: W. Europe Standard Time GMT offset: -60 dst name: W. Europe Daylight Time DST offset: 0

except for the dst name.

It is no good idea to set timezone informations using the registry.

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