World Time API
The World Time API provides the current date and time for any city, latitude/longitude coordinates or timezone in the world, including UTC offset, Unix timestamp and daylight-saving status. Premium plans add business-day arithmetic and working-hours lookups that account for each country's own weekend, its nationwide public holidays and its official make-up working days.
From 7,436 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 344ms | 380ms | 414ms | 629ms | 1198ms |
Didn't find what you were looking for? Suggest an improvement
https://api.api-ninjas.com/v1/worldtime
Get the current date and time by city/state/country, location coordinates (latitude/longitude), or timezone.
Parameters
One of the following parameter combinations must be provided:
timezonelatandloncity(optionally withstateand/orcountry)
timezoneoptionalTimezone name (e.g.
Europe/London).latoptionalLatitude of desired location.
lonoptionalLongitude of desired location.
cityoptionalCity name.
stateoptionalUS state (for United States cities only).
countryoptionalCountry name.
atoptional Premium onlyUTC instant to evaluate instead of the current time, formatted as
YYYY-MM-DDTHH:MM:SS. Resolves the correct historical or future UTC offset for the location, and adds adst_transitionsfield listing the next daylight-saving changes.add_business_daysoptional Premium onlyNumber of business days to add (or subtract, if negative) from the current date in that location, skipping the country's weekend (for example Friday and Saturday in Saudi Arabia) and its nationwide public holidays. Official make-up working days count as business days. Must be between
-3650and3650.business_days_betweenoptional Premium onlyTwo dates formatted as
YYYY-MM-DD,YYYY-MM-DD. Returns the number of business days from the first date up to (not including) the second, excluding the country's weekend and nationwide public holidays.business_hoursoptional Premium onlyOpening hours formatted as
HH:MM-HH:MM. Returns whether the location is currently open, along with the next opening and closing times, accounting for the country's weekend and nationwide public holidays.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
The /v1/worldtime endpoint returns a JSON object with the following fields, or an error if the request is unsuccessful.
timezoneIANA timezone identifier (for example
Europe/London).datetimeLocal date and time string (YYYY-MM-DD HH:MM:SS).
dateCurrent date in YYYY-MM-DD format.
yearCurrent year as a 4-digit string.
monthCurrent month as a 2-digit string between
01and12(inclusive).dayCurrent day of the month as a 2-digit string between
01and31(inclusive).hourCurrent hour in 24-hour format as a 2-digit string between
00and23(inclusive).minuteCurrent minute as a 2-digit string between
00and59(inclusive).secondCurrent second as a 2-digit string between
00and59(inclusive).day_of_weekName of the day of the week (for example
Sunday).utc_offsetOffset from UTC currently in effect at the location, formatted as
+HH:MMor-HH:MM.utc_datetimeThe same instant expressed in UTC, in ISO 8601 format.
unixtimeUnix epoch timestamp in seconds.
abbreviationTimezone abbreviation currently in effect (for example
BSTorEST).dsttrueif daylight saving time is currently in effect at the location.day_of_yearDay of the year as an integer between
1and366.week_numberISO 8601 week number.
business_day_resultPremium onlyReturned when
add_business_daysis set. Containsstart_date,business_days_added,result_date,result_day_of_week,skipped_weekend_days, andskipped_holidays(each with adateandname).business_days_betweenPremium onlyReturned when
business_days_betweenis set. Containsstart_date,end_date,business_days,weekend_days, and theholidaysthat fell in the range.business_hoursPremium onlyReturned when
business_hoursis set. Containsis_open,reason,opens,closes,next_open, andnext_close.dst_transitionsPremium onlyThe next daylight-saving transitions for the loc
ation, each withtransition_utc,utc_offset,dst, andabbreviation.
Live Demo
Code Examples
curl -X GET "https://api.api-ninjas.com/v1/worldtime?city=london" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Frequently Asked Questions
Can I use the World Time API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the World Time API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the World Time API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the World Time API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.How can I look up the current time for a specific location?
You can query by IANAtimezonename (e.g.Europe/London), bylatandloncoordinates, or bycity(optionally narrowed withstateandcountry). If you only have coordinates or a place name, our Geocoding API can resolve them first.Which parameters require a premium subscription?
All location lookups —timezone,lat/lon,city,stateandcountry— are available on every plan, including the free tier. Premium subscriptions add theatparameter for historical and future UTC offsets, plusadd_business_days,business_days_betweenandbusiness_hoursfor holiday-aware business-day calculations; see our pricing page for details.What fields does the response include?
Each response returns thetimezone, a fulldatetimestring (YYYY-MM-DD HH:MM:SS), the individualdate,year,month,day,hour,minute,secondandday_of_weekfields, plusutc_offset,utc_datetime,unixtime,abbreviation,dst,day_of_yearandweek_number; if a request fails you will instead receive an error.Can I calculate business days that skip public holidays?
Yes. Premium subscribers can passadd_business_days(for example?city=London&add_business_days=5) to advance a date by a number of working days, orbusiness_days_between=2026-10-01,2026-10-31to count them across a range. Both skip weekends and the public holidays of the country the location belongs to, and the response lists exactly which holidays were skipped. Usebusiness_hours=09:00-17:00to check whether a location is currently open. For the underlying holiday calendar, see the Holidays API.How does this differ from the Timezone API?
The World Time API returns the live local date and time for a location, while the Timezone API focuses on the timezone metadata itself; you can also resolve city details with the City API.
Explore API integration use cases for recommended APIs and workflow examples.