Claude Skill

time

Time and timezone utilities for getting current time and converting between timezones. Use when: (1) Getting current time in any timezone, (2) Converting time between different timezones, (3) Working with IANA timezone names, (4) Scheduling across timezones, (5) Time-sensitive op

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download dianel555-dskills-skills_time-908af01.zip · 3 KB
Part of dianel555/dskills — 14 skills

Install

skills CLI npx skills add https://github.com/Dianel555/DSkills/tree/main/skills/time
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install dianel555-dskills@llmmart
Git git clone https://github.com/Dianel555/DSkills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole dianel555/dskills collection as a plugin from our marketplace. Git is the plain clone.

README

Time CLI

Time and timezone utilities for AI coding assistants.

Features

  • Get current time in any IANA timezone
  • Convert time between timezones
  • Automatic DST detection
  • Standalone CLI (no MCP dependency)

Installation

pip install pytz  # Python < 3.9
# or use built-in zoneinfo for Python 3.9+

Usage

CLI Commands

# Get current time
python scripts/time_cli.py get --timezone "Asia/Shanghai"

# Convert time
python scripts/time_cli.py convert --time "16:30" --from "America/New_York" --to "Asia/Tokyo"

# List timezones
python scripts/time_cli.py list --filter "America"

License

MIT

Skill manifest

Time

Time and timezone conversion utilities. Standalone CLI only (no MCP dependency).

Execution Methods

Run scripts/time_cli.py via Bash:

# Prerequisites: pip install pytz (or use Python 3.9+ with zoneinfo)

# Get current time in a timezone
python scripts/time_cli.py get --timezone "Asia/Shanghai"
python scripts/time_cli.py get --timezone "America/New_York"
python scripts/time_cli.py get  # Uses system timezone

# Convert time between timezones
python scripts/time_cli.py convert \
  --time "16:30" \
  --from "America/New_York" \
  --to "Asia/Tokyo"

# List available timezones
python scripts/time_cli.py list [--filter "Asia"]

Tool Capability Matrix

Tool Parameters Output
get_current_time timezone (required, IANA name) {timezone, datetime, is_dst}
convert_time source_timezone, time (HH:MM), target_timezone {source, target, time_difference}

Common IANA Timezone Names

Region Timezone
China Asia/Shanghai
Japan Asia/Tokyo
Korea Asia/Seoul
US East America/New_York
US West America/Los_Angeles
UK Europe/London
Germany Europe/Berlin
France Europe/Paris
Australia Australia/Sydney
UTC UTC

Workflow

Getting Current Time

  1. Identify target timezone (use IANA name)
  2. Call get_current_time with timezone parameter
  3. Response includes ISO 8601 datetime and DST status

Converting Time

  1. Identify source timezone and time (24-hour format HH:MM)
  2. Identify target timezone
  3. Call convert_time with all parameters
  4. Response includes both times and time difference

Output Format

get_current_time Response

{
  "timezone": "Asia/Shanghai",
  "datetime": "2024-01-01T21:00:00+08:00",
  "is_dst": false
}

convert_time Response

{
  "source": {
    "timezone": "America/New_York",
    "datetime": "2024-01-01T16:30:00-05:00",
    "is_dst": false
  },
  "target": {
    "timezone": "Asia/Tokyo",
    "datetime": "2024-01-02T06:30:00+09:00",
    "is_dst": false
  },
  "time_difference": "+14.0h"
}

Error Handling

Error Recovery
Invalid timezone Check IANA timezone name spelling
Invalid time format Use 24-hour format HH:MM
MCP unavailable Fall back to CLI script

Anti-Patterns

Prohibited Correct
Use city names directly Use IANA timezone names (e.g., Asia/Tokyo not Tokyo)
Use 12-hour format Use 24-hour format (e.g., 16:30 not 4:30 PM)
Assume timezone Always specify timezone explicitly
Files (dskills)
  • scripts
    • time_cli.py 3.6 KB
      #!/usr/bin/env python3
      """Time CLI - Standalone time and timezone utilities."""
      
      import argparse
      import json
      import sys
      from datetime import datetime
      
      try:
          from zoneinfo import ZoneInfo, available_timezones
      except ImportError:
          from pytz import timezone as ZoneInfo, all_timezones as _all_tz
          def available_timezones():
              return set(_all_tz)
      
      
      def get_current_time(tz_name: str) -> dict:
          """Get current time in specified timezone."""
          try:
              tz = ZoneInfo(tz_name)
              now = datetime.now(tz)
              return {
                  "timezone": tz_name,
                  "datetime": now.isoformat(),
                  "is_dst": bool(now.dst()) if hasattr(now, 'dst') and now.dst() else False
              }
          except Exception as e:
              return {"error": str(e)}
      
      
      def convert_time(source_tz: str, time_str: str, target_tz: str) -> dict:
          """Convert time between timezones."""
          try:
              hour, minute = map(int, time_str.split(':'))
              source = ZoneInfo(source_tz)
              target = ZoneInfo(target_tz)
      
              today = datetime.now(source).date()
              source_dt = datetime(today.year, today.month, today.day, hour, minute, tzinfo=source)
              target_dt = source_dt.astimezone(target)
      
              source_offset = source_dt.utcoffset().total_seconds() / 3600
              target_offset = target_dt.utcoffset().total_seconds() / 3600
              diff = target_offset - source_offset
      
              return {
                  "source": {
                      "timezone": source_tz,
                      "datetime": source_dt.isoformat(),
                      "is_dst": bool(source_dt.dst()) if hasattr(source_dt, 'dst') and source_dt.dst() else False
                  },
                  "target": {
                      "timezone": target_tz,
                      "datetime": target_dt.isoformat(),
                      "is_dst": bool(target_dt.dst()) if hasattr(target_dt, 'dst') and target_dt.dst() else False
                  },
                  "time_difference": f"{diff:+.1f}h"
              }
          except Exception as e:
              return {"error": str(e)}
      
      
      def list_timezones(filter_str: str = None) -> list:
          """List available timezones."""
          zones = sorted(available_timezones())
          if filter_str:
              zones = [z for z in zones if filter_str.lower() in z.lower()]
          return zones
      
      
      def main():
          parser = argparse.ArgumentParser(description="Time and timezone utilities")
          subparsers = parser.add_subparsers(dest="command", required=True)
      
          # get command
          get_parser = subparsers.add_parser("get", help="Get current time")
          get_parser.add_argument("--timezone", "-tz", default="UTC", help="IANA timezone name")
      
          # convert command
          convert_parser = subparsers.add_parser("convert", help="Convert time between timezones")
          convert_parser.add_argument("--time", "-t", required=True, help="Time in HH:MM format")
          convert_parser.add_argument("--from", "-f", dest="source", required=True, help="Source timezone")
          convert_parser.add_argument("--to", "-o", dest="target", required=True, help="Target timezone")
      
          # list command
          list_parser = subparsers.add_parser("list", help="List available timezones")
          list_parser.add_argument("--filter", "-f", help="Filter timezones by substring")
      
          args = parser.parse_args()
      
          if args.command == "get":
              result = get_current_time(args.timezone)
              print(json.dumps(result, indent=2))
          elif args.command == "convert":
              result = convert_time(args.source, args.time, args.target)
              print(json.dumps(result, indent=2))
          elif args.command == "list":
              zones = list_timezones(args.filter)
              for z in zones:
                  print(z)
      
      
      if __name__ == "__main__":
          main()
      
  • README.md 636 B
    # Time CLI
    
    Time and timezone utilities for AI coding assistants.
    
    ## Features
    
    - Get current time in any IANA timezone
    - Convert time between timezones
    - Automatic DST detection
    - Standalone CLI (no MCP dependency)
    
    ## Installation
    
    ```bash
    pip install pytz  # Python < 3.9
    # or use built-in zoneinfo for Python 3.9+
    ```
    
    ## Usage
    
    ### CLI Commands
    
    ```bash
    # Get current time
    python scripts/time_cli.py get --timezone "Asia/Shanghai"
    
    # Convert time
    python scripts/time_cli.py convert --time "16:30" --from "America/New_York" --to "Asia/Tokyo"
    
    # List timezones
    python scripts/time_cli.py list --filter "America"
    ```
    
    ## License
    
    MIT
    
  • SKILL.md 3 KB
    ---
    name: time
    description: |
      Time and timezone utilities for getting current time and converting between timezones. Use when: (1) Getting current time in any timezone, (2) Converting time between different timezones, (3) Working with IANA timezone names, (4) Scheduling across timezones, (5) Time-sensitive operations. Triggers: "what time is it", "current time", "convert time", "timezone", "time in [city]".
    ---
    
    # Time
    
    Time and timezone conversion utilities. Standalone CLI only (no MCP dependency).
    
    ## Execution Methods
    
    Run `scripts/time_cli.py` via Bash:
    
    ```bash
    # Prerequisites: pip install pytz (or use Python 3.9+ with zoneinfo)
    
    # Get current time in a timezone
    python scripts/time_cli.py get --timezone "Asia/Shanghai"
    python scripts/time_cli.py get --timezone "America/New_York"
    python scripts/time_cli.py get  # Uses system timezone
    
    # Convert time between timezones
    python scripts/time_cli.py convert \
      --time "16:30" \
      --from "America/New_York" \
      --to "Asia/Tokyo"
    
    # List available timezones
    python scripts/time_cli.py list [--filter "Asia"]
    ```
    
    ## Tool Capability Matrix
    
    | Tool | Parameters | Output |
    |------|------------|--------|
    | `get_current_time` | `timezone` (required, IANA name) | `{timezone, datetime, is_dst}` |
    | `convert_time` | `source_timezone`, `time` (HH:MM), `target_timezone` | `{source, target, time_difference}` |
    
    ## Common IANA Timezone Names
    
    | Region | Timezone |
    |--------|----------|
    | China | `Asia/Shanghai` |
    | Japan | `Asia/Tokyo` |
    | Korea | `Asia/Seoul` |
    | US East | `America/New_York` |
    | US West | `America/Los_Angeles` |
    | UK | `Europe/London` |
    | Germany | `Europe/Berlin` |
    | France | `Europe/Paris` |
    | Australia | `Australia/Sydney` |
    | UTC | `UTC` |
    
    ## Workflow
    
    ### Getting Current Time
    1. Identify target timezone (use IANA name)
    2. Call `get_current_time` with timezone parameter
    3. Response includes ISO 8601 datetime and DST status
    
    ### Converting Time
    1. Identify source timezone and time (24-hour format HH:MM)
    2. Identify target timezone
    3. Call `convert_time` with all parameters
    4. Response includes both times and time difference
    
    ## Output Format
    
    ### get_current_time Response
    ```json
    {
      "timezone": "Asia/Shanghai",
      "datetime": "2024-01-01T21:00:00+08:00",
      "is_dst": false
    }
    ```
    
    ### convert_time Response
    ```json
    {
      "source": {
        "timezone": "America/New_York",
        "datetime": "2024-01-01T16:30:00-05:00",
        "is_dst": false
      },
      "target": {
        "timezone": "Asia/Tokyo",
        "datetime": "2024-01-02T06:30:00+09:00",
        "is_dst": false
      },
      "time_difference": "+14.0h"
    }
    ```
    
    ## Error Handling
    
    | Error | Recovery |
    |-------|----------|
    | Invalid timezone | Check IANA timezone name spelling |
    | Invalid time format | Use 24-hour format HH:MM |
    | MCP unavailable | Fall back to CLI script |
    
    ## Anti-Patterns
    
    | Prohibited | Correct |
    |------------|---------|
    | Use city names directly | Use IANA timezone names (e.g., `Asia/Tokyo` not `Tokyo`) |
    | Use 12-hour format | Use 24-hour format (e.g., `16:30` not `4:30 PM`) |
    | Assume timezone | Always specify timezone explicitly |
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related