dotnet-timezone
Skill này làm gì
Công cụ này giúp lập trình viên xử lý múi giờ trong code C# (.NET). Nó cung cấp thông tin về cách chuyển đổi thời gian giữa các địa điểm khác nhau, hiểu về giờ mùa hè và bảo đảm code hoạt động đúng trên các hệ điều hành khác nhau.
Khi nào nên dùng
- ✓Khi bạn cần biết múi giờ của một thành phố cụ thể.
- ✓Khi chuyển đổi thời gian giữa UTC và giờ địa phương.
- ✓Để bảo đảm code hoạt động đúng trên cả máy Windows và Linux.
Liên kết skill
https://github.com/github/awesome-copilot/blob/main/skills/dotnet-timezone/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Múi giờ của Tokyo là gì, và cho tôi một ví dụ code C# để chuyển thời gian hiện tại từ UTC sang múi giờ đó.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Công cụ tra cứu một chỉ mục múi giờ đã biết và dùng các thư viện .NET để tìm thông tin chính xác. Nó có thể tạo các đoạn code sẵn dùng tùy theo nhu cầu của bạn, như chuyển đổi đơn giản hoặc lập lịch phức tạp.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
.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:
- Extract each location from the input.
- Read
references/timezone-index.mdfor common Windows and IANA mappings. - If the exact location is not listed, infer the correct IANA zone from geography, then map it to the Windows ID.
- 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, andTimeZoneConverter
Generate Code
Use references/code-patterns.md and pick the smallest pattern that fits:
- Pattern 1:
TimeZoneInfofor Windows-only code - Pattern 2:
TimeZoneConverterfor cross-platform conversion - Pattern 3:
NodaTimefor strict timezone arithmetic and DST-sensitive scheduling - Pattern 4:
DateTimeOffsetfor 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.Nowin databases; store UTC instead. - Treat
DateTimeKind.Unspecifiedas 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:
- Return the resolved timezone block for each location.
- State the recommended implementation in one sentence.
- Include a copy-paste-ready C# snippet.
For code and architecture requests:
- State the recommended approach in one sentence.
- Provide the timezone IDs if relevant.
- Include the minimal working code snippet.
- Mention the package requirement if needed.
- Add one pitfall warning if it matters.
Keep responses concise and code-first.
References
references/timezone-index.md: common Windows and IANA timezone mappingsreferences/code-patterns.md: ready-to-use .NET timezone patterns
Câu hỏi thường gặp
UTC là gì?
UTC (Coordinated Universal Time) là chuẩn thời gian chính mà thế giới dùng để điều chỉnh đồng hồ. Nó giống “Giờ chuẩn Greenwich” (GMT) nhưng chính xác hơn.
Giờ mùa hè (DST) là gì?
DST là khi đồng hồ được điều chỉnh tới trước, thường vào mùa xuân, để tận dụng ánh sáng ban ngày tốt hơn. Không phải nơi nào cũng áp dụng.
Tại sao tôi cần quan tâm đến múi giờ trong code?
Nếu ứng dụng của bạn xử lý ngày và giờ từ nhiều nơi (hoặc ngay cả từ chính bạn), dùng đúng múi giờ là rất quan trọng để tránh lỗi, đặc biệt khi lập lịch hoặc hiển thị thông tin cho người dùng ở các khu vực khác nhau.
Chi tiết
Mô tả gốc của tác giả
.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
Độ phổ biến
- Sao GitHub
- 40k
- Vị trí xếp hạng
- #7180
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
acquire-codebase-knowledge
40kGiúp agent của bạn hiểu và ghi tài liệu cho một dự án mã nguồn có sẵn. Hữu ích khi đón thành viên mới hoặc nắm tổng quan về kiến trúc.
acreadiness-assess
40kGiúp agent của bạn đánh giá mức độ sẵn sàng cho AI của dự án và tạo báo cáo. Hữu ích để biết dự án đã sẵn sàng dùng công cụ AI đến đâu.
acreadiness-generate-instructions
40kGiúp agent của bạn tạo hướng dẫn cho công cụ AI dựa trên kết quả đánh giá. Hữu ích để cải thiện cách AI làm việc với mã và khắc phục các khoảng trống.
acreadiness-policy
40kGiúp agent của bạn xác định hoặc áp dụng chính sách đánh giá dự án bằng AI. Hữu ích để chuẩn hóa cách đánh giá dự án và đảm bảo tuân thủ.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.