# Time and Date API: Get sunrise and sunset

> Gets daily sunrise, sunset, solar noon, day length and civil twilight for a place from Time and Date, for one or more consecutive days. Times are local with UTC offset; days without sunrise or sunset are marked.

Unofficial. Not affiliated with or endorsed by Time and Date.

- Page: https://fous.com/methods/timeanddate.com/get-sunrise-and-sunset
- Method: `timeanddate.com/get_sunrise_and_sunset`, version 1
- Website: timeanddate.com
- Returns: place, per day: sunrise, sunset, solar noon, day length, civil twilight start/end, note, page URL
- Effect: read (it gets data and changes nothing)
- Sign-in: none needed
- Cost: 1 credit per completed run (1¢ with pay as you go); failed runs are free
- Verified: Nov 2, 2026

## Inputs

| Field | Type | Required | In the run below | Description |
|---|---|---|---|---|
| `date` | string | no | `"2026-11-25"` | First local calendar date (YYYY-MM-DD), for example 2026-06-20. Defaults to today in the matched place. |
| `days` | integer | no | `31` | Number of consecutive days, for example 3. Defaults to 1. Default 1. |
| `location` | string | yes | `"New Delhi"` | City or place to look up, for example Reykjavik. A Time and Date /sun/ page URL or place id also works. |

## Output

From a run on Oct 31, 2026, shortened. Its input:

```json
{
  "date": "2026-11-25",
  "days": 31,
  "location": "New Delhi"
}
```

Its output:

```json
{
  "days": [
    {
      "date": "2026-11-25",
      "note": null,
      "sunset": "2026-11-25T17:24+05:30",
      "sunrise": "2026-11-25T06:51+05:30",
      "page_url": "https://www.timeanddate.com/sun/india/new-delhi?month=11&year=2026",
      "day_length": "10 h 32 min",
      "solar_noon": "2026-11-25T12:08+05:30",
      "civil_twilight_end": "2026-11-25T17:49+05:30",
      "civil_twilight_start": "2026-11-25T06:26+05:30"
    },
    {
      "date": "2026-11-26",
      "note": null,
      "sunset": "2026-11-26T17:24+05:30",
      "sunrise": "2026-11-26T06:52+05:30",
      "page_url": "https://www.timeanddate.com/sun/india/new-delhi?month=11&year=2026",
      "day_length": "10 h 32 min",
      "solar_noon": "2026-11-26T12:08+05:30",
      "civil_twilight_end": "2026-11-26T17:49+05:30",
      "civil_twilight_start": "2026-11-26T06:26+05:30"
    },
    {
      "date": "2026-11-27",
      "note": null,
      "sunset": "2026-11-27T17:24+05:30",
      "sunrise": "2026-11-27T06:53+05:30",
      "page_url": "https://www.timeanddate.com/sun/india/new-delhi?month=11&year=2026",
      "day_length": "10 h 31 min",
      "solar_noon": "2026-11-27T12:08+05:30",
      "civil_twilight_end": "2026-11-27T17:49+05:30",
      "civil_twilight_start": "2026-11-27T06:27+05:30"
    }
  ],
  "place": "New Delhi, Delhi, India"
}
```

## Run it

From code, with a Fous API key in `FOUS_API_KEY`; the answer's `data` holds the output:

```bash
curl https://api.fous.com/v1/runs \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"method":"timeanddate.com/get_sunrise_and_sunset","input":{"date":"2026-11-25","days":31,"location":"New Delhi"}}'
```

From an AI agent connected to the Fous MCP server: its `run` with the same method and input. To connect one, give it `set up https://fous.com/SKILL.md`.

## Ask your agent

- What time does the sun rise and set in Reykjavik on 2026-06-20?
- I need sunrise, sunset and civil twilight times for Tromsø for the 7 days starting December 15, 2025 — flag any days where the sun doesn't rise at all.
- Pull the day length and solar noon for Cape Town for each day from March 1 to March 10, 2026 using timeanddate.com.
- Planning a golden-hour photo shoot in Santorini next week — when is sunset on 2026-05-12 and 2026-05-13, and when does civil twilight end?
- Check Time and Date for today's sunrise and sunset in Anchorage, Alaska, with the UTC offset included.

## Input schema

```json
{
  "type": "object",
  "required": [
    "location"
  ],
  "properties": {
    "date": {
      "type": "string",
      "description": "First local calendar date (YYYY-MM-DD), for example 2026-06-20. Defaults to today in the matched place."
    },
    "days": {
      "type": "integer",
      "default": 1,
      "maximum": 31,
      "minimum": 1,
      "description": "Number of consecutive days, for example 3. Defaults to 1."
    },
    "location": {
      "type": "string",
      "minLength": 1,
      "description": "City or place to look up, for example Reykjavik. A Time and Date /sun/ page URL or place id also works."
    }
  }
}
```

## Output schema

```json
{
  "type": "object",
  "required": [
    "place",
    "days"
  ],
  "properties": {
    "days": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "date",
          "sunrise",
          "sunset",
          "solar_noon",
          "day_length",
          "civil_twilight_start",
          "civil_twilight_end",
          "note",
          "page_url"
        ],
        "properties": {
          "date": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Reason a sun or twilight time is unavailable."
          },
          "sunset": {
            "type": [
              "string",
              "null"
            ],
            "description": "Sunset in local ISO 8601 time with UTC offset."
          },
          "sunrise": {
            "type": [
              "string",
              "null"
            ],
            "description": "Sunrise in local ISO 8601 time with UTC offset."
          },
          "page_url": {
            "type": "string",
            "description": "Place sunrise and sunset page for this date."
          },
          "day_length": {
            "type": [
              "string",
              "null"
            ],
            "description": "Length of daylight in hours and minutes."
          },
          "solar_noon": {
            "type": [
              "string",
              "null"
            ],
            "description": "Solar noon in local ISO 8601 time with UTC offset."
          },
          "civil_twilight_end": {
            "type": [
              "string",
              "null"
            ],
            "description": "End of civil twilight in local ISO 8601 time with UTC offset."
          },
          "civil_twilight_start": {
            "type": [
              "string",
              "null"
            ],
            "description": "Start of civil twilight in local ISO 8601 time with UTC offset."
          }
        },
        "additionalProperties": false
      }
    },
    "place": {
      "type": "string",
      "description": "Matched place name."
    }
  },
  "additionalProperties": false
}
```

## See more

- [Time and Date API: Get time in city](https://fous.com/methods/timeanddate.com/get-time-in-city.md): Gets the current local time, time zone, and next daylight saving change for a city listed on Time and Date. Add a state or country to distinguish cities with the same name.
- [Time and Date API: Convert time between cities](https://fous.com/methods/timeanddate.com/convert-time-between-cities.md): Converts a meeting time in one city to local times in other cities, with time zones and 09:00-17:00 working-hours status. Supports dates from 1970 to 2030; ambiguous clock-change times use the first occurrence.
- [Time and Date API: Count business days](https://fous.com/methods/timeanddate.com/count-business-days.md): Counts weekdays between two dates, excluding nationwide public holidays or, optionally, public holidays in a state or province, from Time and Date's published holiday calendar.
- [The Weather Channel API: Get daily forecast](https://fous.com/methods/weather.com/get-daily-forecast.md): Gets The Weather Channel's daily forecast for a city, address, ZIP code or postcode: up to 15 upcoming days with highs, lows, conditions, rain chance, wind, humidity, UV and sun times.
- [NOAA API: Get tide times](https://fous.com/methods/tidesandcurrents.noaa.gov/get-tide-times.md): Finds the nearest NOAA tide prediction station to a US coastal place (within 30 miles) and returns its high and low tide times in local time with predicted heights above MLLW.
- [Weather Underground API: Get historical weather](https://fous.com/methods/wunderground.com/get-historical-weather.md): Gets daily weather and time-ordered airport observations for a past date near a city, airport, or ZIP code. Summary averages use the available observations; missing measurements are null.
- [MSN API: Get forecast](https://fous.com/methods/msn.com/get-forecast.md): Gets up to 10 days of MSN Weather forecasts for a city, address, or ZIP code, with optional hourly forecasts for the next 24 hours.
- [NASA API: Get ISS sightings](https://fous.com/methods/nasa.gov/get-iss-sightings.md): Finds upcoming International Space Station sightings for a city in NASA's city list, with local start times, visibility and sky directions. Cities without scheduled passes return an empty list.
- [All Time and Date methods](https://fous.com/methods/timeanddate.com.md)
