dotnet Timezone Helper

dotnet Timezone Helper

Helps with .NET timezone handling: finds Windows and IANA timezone IDs for places, converts UTC, handles daylight saving and gives copy-ready C# code.

Skill files3 files

references/

SKILL.md110 lines
1
---
2
name: dotnet-timezone
3
description: '.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.'
4
---
5
6
# .NET Timezone
7
8
Resolve timezone questions for .NET and C# code with production-safe guidance and copy-paste-ready snippets.
9
10
## Start With The Right Path
11
12
Identify the request type first:
13
14
- Address or location lookup
15
- Timezone ID lookup
16
- UTC/local conversion
17
- Cross-platform timezone compatibility
18
- Scheduling or DST handling
19
- API or persistence design
20
21
If the library is unclear, default to `TimeZoneConverter` for cross-platform work. If the scenario involves recurring schedules or strict DST rules, prefer `NodaTime`.
22
23
## Resolve Addresses And Locations
24
25
If the user provides an address, city, region, country, or document containing place names:
26
27
1. Extract each location from the input.
28
2. Read `references/timezone-index.md` for common Windows and IANA mappings.
29
3. If the exact location is not listed, infer the correct IANA zone from geography, then map it to the Windows ID.
30
4. Return both IDs and a ready-to-use C# example.
31
32
For each resolved location, provide:
33
34
```text
35
Location: <resolved place>
36
Windows ID: <windows id>
37
IANA ID: <iana id>
38
UTC offset: <standard offset and DST offset when relevant>
39
DST: <yes/no>
40
```
41
42
Then include a cross-platform snippet like:
43
44
```csharp
45
using TimeZoneConverter;
46
47
TimeZoneInfo tz = TZConvert.GetTimeZoneInfo("Asia/Colombo");
48
DateTime local = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tz);
49
```
50
51
If multiple locations are present, include one block per location and then a combined multi-timezone snippet.
52
53
If a location is ambiguous, list the possible timezone matches and ask the user to choose the correct one.
54
55
## Look Up Timezone IDs
56
57
Use `references/timezone-index.md` for Windows to IANA mappings.
58
59
Always provide both formats:
60
61
- Windows ID for `TimeZoneInfo.FindSystemTimeZoneById()` on Windows
62
- IANA ID for Linux, containers, `NodaTime`, and `TimeZoneConverter`
63
64
## Generate Code
65
66
Use `references/code-patterns.md` and pick the smallest pattern that fits:
67
68
- Pattern 1: `TimeZoneInfo` for Windows-only code
69
- Pattern 2: `TimeZoneConverter` for cross-platform conversion
70
- Pattern 3: `NodaTime` for strict timezone arithmetic and DST-sensitive scheduling
71
- Pattern 4: `DateTimeOffset` for APIs and data transfer
72
- Pattern 5: ASP.NET Core persistence and presentation
73
- Pattern 6: recurring jobs and schedulers
74
- Pattern 7: ambiguous and invalid DST timestamps
75
76
Always include package guidance when recommending third-party libraries.
77
78
## Warn About Common Pitfalls
79
80
Mention the relevant warning when applicable:
81
82
- `TimeZoneInfo.FindSystemTimeZoneById()` is platform-specific for timezone IDs.
83
- Avoid storing `DateTime.Now` in databases; store UTC instead.
84
- Treat `DateTimeKind.Unspecified` as a bug risk unless it is deliberate input.
85
- DST transitions can skip or repeat local times.
86
- Azure Windows and Azure Linux environments may expect different timezone ID formats.
87
88
## Response Shape
89
90
For address and location requests:
91
92
1. Return the resolved timezone block for each location.
93
2. State the recommended implementation in one sentence.
94
3. Include a copy-paste-ready C# snippet.
95
96
For code and architecture requests:
97
98
1. State the recommended approach in one sentence.
99
2. Provide the timezone IDs if relevant.
100
3. Include the minimal working code snippet.
101
4. Mention the package requirement if needed.
102
5. Add one pitfall warning if it matters.
103
104
Keep responses concise and code-first.
105
106
## References
107
108
- `references/timezone-index.md`: common Windows and IANA timezone mappings
109
- `references/code-patterns.md`: ready-to-use .NET timezone patterns
110

© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…