में नोडा टाइम iana मैपिंग मेरे पास एक वैश्विक वेबसाइट है जो सर्वर पर आईएएनए टाइमज़ोन आईडी पास कर रही है और सी # 5 वेब ऐप में विंडोज टाइमज़ोन में मैप करने के लिए नोडा टाइम का उपयोग कर रही है।एडीसी/यूटीसी के विंडोज़ टाइमज़ोन
"एटीसी/यूटीसी" सर्वर को पास किया जा रहा है लेकिन नोडा टाइम इसे विंडोज़ समय क्षेत्र में मैप नहीं कर सकता है। मैं एक आईएएनए टाइमज़ोन आईडी कैसे मैप कर सकता हूं?
public TimeZoneInfo GetTimeZoneByIanaId(string ianaTimeZoneId)
{
TzdbDateTimeZoneSource timeZoneSource = TzdbDateTimeZoneSource.Default;
IList<MapZone> zoneMaps = timeZoneSource.WindowsMapping.MapZones;
// resolve any link, since the CLDR doesn't necessarily use canonical IDs
IList<string> mapZoneIds = timeZoneSource.CanonicalIdMap.Where(map => map.Value.Equals(ianaTimeZoneId, StringComparison.OrdinalIgnoreCase)).Select(x => x.Key).ToList();
MapZone mapZone = zoneMaps.FirstOrDefault(zoneMap => zoneMap.TzdbIds.Any(mapZoneIds.Contains));
if (mapZone == null)
{
throw new TimeZoneNotFoundException("Unable to determine the clients timezone using the jsTimezoneDetect plugin");
}
TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById(mapZone.WindowsId);
if (timeZone == null)
{
throw new TimeZoneNotFoundException("Unable to determine the clients timezone from NodaTime");
}
return timeZone;
}
https://code.google.com/p/noda-time/source/browse/data/cldr/windowsZones-25.xml पर देखकर, ऐसा लगता है कि यूटीसी की सीएलडीआर-परिभाषित मैपिंग नहीं है। आपको बस इसे हार्ड-कोड करने की आवश्यकता हो सकती है :( –
ठीक है, धन्यवाद। हाँ, यह प्रविष्टि का मामला मानचित्र में मौजूद नहीं है :( –