Overview
WorldTimeAPI is a simple web service which returns the local-time for a given timezone as either JSON or plain-text. Some additional information is provided, such as whether that timezone is currently in Daylight Savings Time, when DST starts and ends, the UTC offset, etc.
A full list of timezones can be found here, and further details about this service can be found in the FAQs.
Examples
Note: by default, the API returns JSON. Adding a suffix of .txt
to any API URL will return a plain-text response, which may be easier to parse on some systems.
Request a list of valid timezones (as JSON):
$ curl "http://worldtimeapi.org/api/timezone"
Request a list of valid locations for an area (as JSON):
http://worldtimeapi.org/api/timezone/:area
$ curl "http://worldtimeapi.org/api/timezone/Europe"
Request the current time for a timezone (in plain text or JSON):
http://worldtimeapi.org/api/timezone/:area/:location[/:region]
$ curl "http://worldtimeapi.org/api/timezone/Europe/London.txt"
$ curl "http://worldtimeapi.org/api/timezone/America/Argentina/Salta"
Request the current time based on your public IP (as JSON):
$ curl "http://worldtimeapi.org/api/ip"
Request the current time for a specific IP (in plain text):
http://worldtimeapi.org/api/ip/:ipv4
$ curl "http://worldtimeapi.org/api/ip/3.235.11.178.txt"