Resolve timezone questions for .NET and C# code with production-safe guidance and copy-paste-ready snippets.
Identify the request type first:
If the library is unclear, default to TimeZoneConverter for cross-platform work. If the scenario involves recurring schedules or strict DST rules, prefer NodaTime.
If the user provides an address, city, region, country, or document containing place names:
references/timezone-index.md for common Windows and IANA mappings.For each resolved location, provide:
Location: <resolved place>
Windows ID: <windows id>
IANA ID: <iana id>
UTC offset: <standard offset and DST offset when relevant>
DST: <yes/no>
Then include a cross-platform snippet like:
using TimeZoneConverter;
TimeZoneInfo tz = TZConvert.GetTimeZoneInfo("Asia/Colombo");
DateTime local = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tz);
If multiple locations are present, include one block per location and then a combined multi-timezone snippet.
If a location is ambiguous, list the possible timezone matches and ask the user to choose the correct one.
Use references/timezone-index.md for Windows to IANA mappings.
Always provide both formats:
TimeZoneInfo.FindSystemTimeZoneById() on WindowsNodaTime, and TimeZoneConverter
Use references/code-patterns.md and pick the smallest pattern that fits:
TimeZoneInfo for Windows-only codeTimeZoneConverter for cross-platform conversionNodaTime for strict timezone arithmetic and DST-sensitive schedulingDateTimeOffset for APIs and data transferAlways include package guidance when recommending third-party libraries.
Mention the relevant warning when applicable:
TimeZoneInfo.FindSystemTimeZoneById() is platform-specific for timezone IDs.DateTime.Now in databases; store UTC instead.DateTimeKind.Unspecified as a bug risk unless it is deliberate input.For address and location requests:
For code and architecture requests:
Keep responses concise and code-first.
references/timezone-index.md: common Windows and IANA timezone mappingsreferences/code-patterns.md: ready-to-use .NET timezone patterns