Zum Inhalt springen
Skillpedia
Allgemeines Programmieren40k · #7180

dotnet-timezone

Was er macht

Dieses Tool hilft Programmierern, Zeitzonen in ihrem C#-(.NET-)Code zu handhaben. Es zeigt, wie man Uhrzeiten zwischen verschiedenen Orten umrechnet, wie die Sommerzeit funktioniert und wie der Code auf unterschiedlichen Betriebssystemen korrekt läuft.

Wann du ihn nutzt

  • ✓Wenn du die Zeitzone einer bestimmten Stadt wissen musst.
  • ✓Wenn du Uhrzeiten zwischen UTC und Ortszeit umrechnest.
  • ✓Wenn du sicherstellen willst, dass dein Code sowohl auf Windows- als auch auf Linux-Rechnern korrekt läuft.

Link zum Skill

https://github.com/github/awesome-copilot/blob/main/skills/dotnet-timezone/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/github/awesome-copilot/blob/main/skills/dotnet-timezone/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Was ist die Zeitzone für Tokio, und gib mir ein C#-Codebeispiel, das die aktuelle Zeit von UTC dorthin umrechnet.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Das Tool sucht einen bekannten Zeitzonen-Eintrag und nutzt .NET-Bibliotheken, um die richtigen Informationen zu finden. Je nach Bedarf erstellt es fertige Codeschnipsel, zum Beispiel für eine einfache Umrechnung oder eine komplexe Terminplanung.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

.NET Timezone

Resolve timezone questions for .NET and C# code with production-safe guidance and copy-paste-ready snippets.

Start With The Right Path

Identify the request type first:

  • Address or location lookup
  • Timezone ID lookup
  • UTC/local conversion
  • Cross-platform timezone compatibility
  • Scheduling or DST handling
  • API or persistence design

If the library is unclear, default to TimeZoneConverter for cross-platform work. If the scenario involves recurring schedules or strict DST rules, prefer NodaTime.

Resolve Addresses And Locations

If the user provides an address, city, region, country, or document containing place names:

  1. Extract each location from the input.
  2. Read references/timezone-index.md for common Windows and IANA mappings.
  3. If the exact location is not listed, infer the correct IANA zone from geography, then map it to the Windows ID.
  4. Return both IDs and a ready-to-use C# example.

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.

Look Up Timezone IDs

Use references/timezone-index.md for Windows to IANA mappings.

Always provide both formats:

  • Windows ID for TimeZoneInfo.FindSystemTimeZoneById() on Windows
  • IANA ID for Linux, containers, NodaTime, and TimeZoneConverter

Generate Code

Use references/code-patterns.md and pick the smallest pattern that fits:

  • Pattern 1: TimeZoneInfo for Windows-only code
  • Pattern 2: TimeZoneConverter for cross-platform conversion
  • Pattern 3: NodaTime for strict timezone arithmetic and DST-sensitive scheduling
  • Pattern 4: DateTimeOffset for APIs and data transfer
  • Pattern 5: ASP.NET Core persistence and presentation
  • Pattern 6: recurring jobs and schedulers
  • Pattern 7: ambiguous and invalid DST timestamps

Always include package guidance when recommending third-party libraries.

Warn About Common Pitfalls

Mention the relevant warning when applicable:

  • TimeZoneInfo.FindSystemTimeZoneById() is platform-specific for timezone IDs.
  • Avoid storing DateTime.Now in databases; store UTC instead.
  • Treat DateTimeKind.Unspecified as a bug risk unless it is deliberate input.
  • DST transitions can skip or repeat local times.
  • Azure Windows and Azure Linux environments may expect different timezone ID formats.

Response Shape

For address and location requests:

  1. Return the resolved timezone block for each location.
  2. State the recommended implementation in one sentence.
  3. Include a copy-paste-ready C# snippet.

For code and architecture requests:

  1. State the recommended approach in one sentence.
  2. Provide the timezone IDs if relevant.
  3. Include the minimal working code snippet.
  4. Mention the package requirement if needed.
  5. Add one pitfall warning if it matters.

Keep responses concise and code-first.

References

  • references/timezone-index.md: common Windows and IANA timezone mappings
  • references/code-patterns.md: ready-to-use .NET timezone patterns
Häufige Fragen

Was ist UTC?

UTC (Koordinierte Weltzeit) ist der Standard, nach dem weltweit die Uhren gestellt werden. Sie ähnelt der „Greenwich Mean Time“ (GMT), ist aber genauer.

Was ist die Sommerzeit (DST)?

Bei der Sommerzeit werden die Uhren meist im Frühjahr vorgestellt, um das Tageslicht besser zu nutzen. Nicht alle Länder führen sie ein.

Warum muss ich mich in Code um Zeitzonen kümmern?

Wenn deine Anwendung Datums- und Zeitangaben aus verschiedenen Orten verarbeitet (oder sogar nur aus deinem eigenen), sind korrekte Zeitzonen wichtig, um Fehler zu vermeiden. Das gilt besonders bei Terminplanung oder wenn du Informationen für Nutzer in verschiedenen Regionen anzeigst.

Details

Originalbeschreibung des Autors

.NET timezone handling guidance for C# applications. Use when working with TimeZoneInfo, DateTimeOffset, NodaTime, UTC conversion, daylight saving time, scheduling across timezones, cross-platform Windows/IANA timezone IDs, or when a .NET user needs the timezone for a city, address, region, or country and copy-paste-ready C# code.

repo: github/awesome-copilot

Beliebtheit

GitHub-Sterne
40k
Platz im Ranking
#7180
Lizenz
MIT
Aktualisiert
15.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills