Time API

Get current time in any timezone, convert times between timezones, and retrieve detailed day information including sunrise, sunset, solar noon, and zawal window calculations. All calculations use the same astronomical algorithms as the Prayer Times API for consistency.

Get Current Time

Get the current time in a specific timezone. Timezone can be auto-detected from coordinates or specified directly.

GET/v1/time/now

Query Parameters

NameTypeRequiredDescription
latfloatOptionalLatitude (-90 to 90). Required if timezone is not provided.
lngfloatOptionalLongitude (-180 to 180). Required if timezone is not provided.
timezonestringOptionalIANA timezone name (e.g., 'America/New_York', 'Asia/Kolkata'). Required if lat/lng are not provided.

Example Request

curl "https://api.falakapi.com/v1/time/now?lat=28.66&lng=77.07" \
  -H "X-API-Key: fak_your_api_key_here"

# Or with explicit timezone:
curl "https://api.falakapi.com/v1/time/now?timezone=America/New_York" \
  -H "X-API-Key: fak_your_api_key_here"

Example Response

{
  "timezone": "Asia/Kolkata",
  "datetime": "2025-11-24T19:30:45+05:30",
  "date": "2025-11-24",
  "time": "19:30:45",
  "utc_offset": "+05:30",
  "unix": 1732371645
}

Notes

  • Either lat/lng OR timezone must be provided
  • If lat/lng are provided, timezone is auto-detected using coordinate lookup
  • UTC offset includes daylight saving time adjustments
  • Unix timestamp is in seconds since epoch (UTC)

Convert Time Between Timezones

Convert a datetime from one timezone to another. The input datetime should be in ISO8601 format without timezone offset.

GET/v1/time/convert

Query Parameters

NameTypeRequiredDescription
from_tzstringRequiredSource IANA timezone name (e.g., 'America/New_York')
to_tzstringRequiredDestination IANA timezone name (e.g., 'Asia/Kolkata')
datetimestringRequiredDatetime in ISO8601 format without offset (e.g., '2025-11-17T09:00:00')

Example Request

curl "https://api.falakapi.com/v1/time/convert?from_tz=America/New_York&to_tz=Asia/Kolkata&datetime=2025-11-17T09:00:00" \
  -H "X-API-Key: fak_your_api_key_here"

Example Response

{
  "from": {
    "timezone": "America/New_York",
    "datetime": "2025-11-17T09:00:00-05:00",
    "unix": 1734444000
  },
  "to": {
    "timezone": "Asia/Kolkata",
    "datetime": "2025-11-17T19:30:00+05:30",
    "unix": 1734444000
  }
}

Notes

  • The datetime parameter should be in format: YYYY-MM-DDTHH:MM:SS (e.g., '2025-11-17T09:00:00')
  • Both source and destination times are returned with Unix timestamps
  • The Unix timestamp represents the same moment in time (UTC) for both timezones
  • Daylight saving time is automatically handled

Get Day Information

Get detailed information about a specific day including sunrise, sunset, solar noon, zawal window, and day/night lengths. Uses the same solar calculations as the Prayer Times API.

GET/v1/time/day-info

Query Parameters

NameTypeRequiredDescription
latfloatRequiredLatitude (-90 to 90)
lngfloatRequiredLongitude (-180 to 180)
datestringOptionalDate in YYYY-MM-DD format (default: today in local timezone)

Example Request

curl "https://api.falakapi.com/v1/time/day-info?lat=28.66&lng=77.07&date=2025-11-17" \
  -H "X-API-Key: fak_your_api_key_here"

Example Response

{
  "coordinates": {
    "latitude": 28.66,
    "longitude": 77.07
  },
  "date": {
    "gregorian": "2025-11-17",
    "timestamp": 1734393600
  },
  "timezone": "Asia/Kolkata",
  "day_info": {
    "sunrise": "06:45",
    "sunset": "17:27",
    "solar_noon": "12:06",
    "zawal_start": "12:01",
    "zawal": "12:06",
    "zawal_end": "12:11",
    "day_length_seconds": 38520,
    "day_length_human": "10h 42m",
    "night_length_seconds": 47880,
    "night_length_human": "13h 18m"
  }
}

Notes

  • Sunrise and sunset times account for atmospheric refraction (90.833° angle)
  • Solar noon is when the sun reaches its highest point in the sky
  • Zawal window is 10 minutes total (5 minutes before and after solar noon) - prayer is prohibited during this time
  • Day length is calculated as the time between sunrise and sunset
  • Night length is calculated as 24 hours minus day length
  • All times are in the local timezone (auto-detected from coordinates)
  • Uses the same solar calculation algorithms as the Prayer Times API for consistency

Use Cases

🌍 Multi-Timezone Applications

Display current time for users in different timezones. Auto-detect timezone from user location or allow manual timezone selection.

⏰ Time Conversion

Convert meeting times, event schedules, or deadlines between timezones. Perfect for scheduling applications and calendar integrations.

🌅 Day Planning

Get sunrise, sunset, and solar noon times for outdoor activities, photography, or agricultural planning. Day and night length information helps with scheduling.

🕌 Islamic Applications

Use zawal window information to avoid scheduling prayers during forbidden times. Solar noon calculations are consistent with prayer time calculations.

Timezone Detection

When you provide latitude and longitude coordinates, the API automatically detects the timezone using our timezone lookup system. This ensures accurate local time calculations without requiring users to know their timezone.

Example: Coordinates for Delhi, India (28.66, 77.07) automatically resolve toAsia/Kolkata timezone.

Solar Calculations

The day information endpoint uses the same astronomical algorithms as the Prayer Times API. This ensures consistency across all solar-based calculations in FalakAPI.

EventDescription
SunriseWhen the sun's upper edge appears on the horizon (accounts for atmospheric refraction)
Solar NoonThe exact moment the sun crosses the meridian (highest point in the sky)
SunsetWhen the sun's upper edge disappears below the horizon (accounts for atmospheric refraction)
Zawal Window10-minute window around solar noon (5 minutes before and after) when prayer is prohibited in Islamic tradition