Key:opening_hours
![]() |
Description |
---|
Describes when something is open or closed. There is a specific standard format for this data. ![]() |
Group: Properties |
Used on these elements |
Documented values: 1 |
See also |
Status: de facto |
|
Tools for this tag |
|
Wikidata |
Q99518990 |
The key opening_hours=* is added to a feature to describe when it is open or closed. There is a specific standard format for this data.
It is possible to enter opening hours for almost everything that has known hours of operation.
Additionally, you can tag the URL where the current opening hours can be looked up with opening_hours:url=https://example.org/.
The syntax is quite complex, but it allows to enter even some highly complicated opening hour rules. For most mappers, using special tools like the OpeningHoursEditor plugin in JOSM (can be added in plugin menu in preferences), built-in special editor in Vespucci, OsmAnd or StreetComplete opening hours quest is going to be better than attempting to edit tag values directly.
Proposed features/Time domains and Key:opening_hours/specification are related documents with more information about the syntax of this key.
Simple examples
Open on weekdays
- You should use the common English day abbreviations as in this table:
Abbreviation | Day of week |
---|---|
Mo | Monday |
Tu | Tuesday |
We | Wednesday |
Th | Thursday |
Fr | Friday |
Sa | Saturday |
Su | Sunday |
Multiple opening intervals
opening_hours=Mo-Fr 08:00-12:00,13:00-17:30 |
same as above, but closed from 12:00 to 13:00 (noon to 1 PM) |
- Add the two time intervals in which they are open, separated by a comma (,).
Multiple days
opening_hours=Mo-Fr 08:00-12:00,13:00-17:30; Sa 08:00-12:00 |
same as above, also open on Saturday mornings |
- Add the opening hours for each day range, separated by a semicolon and space (; ).
Closed on holidays
opening_hours=Mo-Fr 08:00-12:00,13:00-17:30; Sa 08:00-12:00; PH off |
same as above, but closed on public holidays |
- Use
PH
as if it were a weekday. Instead of hours, useoff
to say they're closed all day. - Use
SH
for school holidays. Although this is rare, you can also use bothPH
andSH
on the same object, e.g. opening_hours=Mo-Fr 08:00-12:00,13:00-17:30; Sa 08:00-12:00; PH off; SH off
Different hours on holidays
opening_hours=Mo-Fr 08:00-12:00,13:00-17:30; Sa 08:00-12:00; PH 09:00-12:00 |
on holidays, they are open from 09:00 to 12:00 |
- As said before,
PH
is just like a weekday. Because it is to the right of the rest of the rules, it overwrites them. For more information on which rules take precedence, see this more elaborate guide.
How to map
This is a property tag so it must go with a related tag; e.g.,
- shop=*
- amenity=biergarten
- amenity=charging_station
- amenity=fast_food
- amenity=fuel
- amenity=library
- amenity=parking
- amenity=pharmacy
- amenity=pub
- amenity=restaurant
- amenity=toilets
- tourism=museum
- …
Values
Before tagging ways , see Key:access.
The evaluation tool and YoHours are web tools which help to determine the values. Please use English for weekday and month names.
Examples
- 24/7
- Applied to: any non-stop facilities (related tags), 24 hours a day, 7 days a week
- Render on map: something like object icon with a 24
- Sa-Su 00:00-24:00
- Applied to: opens only the weekend but non-stop, 24 hour
- Mo-Fr 08:30-20:00 or for more complex opening hours:
- Mo 10:00-12:00,12:30-15:00; Tu-Fr 08:00-12:00,12:30-15:00; Sa 08:00-12:00
- Mo-Su 08:00-18:00; Apr 10-15 off; Jun 08:00-14:00; Aug off; Dec 25 off
- Applied to: any facilities with opening hours (related tags)
- Render on map: nothing, information recovered by software
- Mo-Sa 10:00-20:00; Tu off or Mo-Sa 10:00-20:00; Tu 10:00-14:00
- For exceptions in a range of days
- Applied to: any facilities with opening hours (related tags)
- Render on map: nothing, information recovered by software
- sunrise-sunset
- Applied to: opens every day between sunrise and sunset.
- Use round brackets to add a time offset, for example a park that opens 2 hours after sunrise and closes 2 hours before sunset (sunrise+02:00)-(sunset-02:00)
- Su 10:00+
- Sunday from 10:00 to an unknown or unspecified closing time.
- Applied to: any facilities with opening hours (related tags)
- Render on map: nothing, information recovered by software
- week 1-53/2 Fr 09:00-12:00; week 2-52/2 We 09:00-12:00
- Open from 09:00 to 12:00 on Fridays of odd weeks and on the Wednesdays of even weeks
- Applied to: any facilities with opening hours (related tags)
- Render on map: nothing, information recovered by software
- Mo-Sa 08:00-13:00,14:00-17:00 || "by appointment"
- Here does the fallback rule come in handy. It applies for any time which was not handled by previous rules.
- Su-Tu 11:00-01:00, We-Th 11:00-03:00, Fr 11:00-06:00, Sa 11:00-07:00
- Because of the definition that following rules will overwrite previous once, times which span over midnight have to use additional rules which are separated by a comma instead of a semicolon.
- Mo-Su,PH 15:00-03:00; easter -2 days off
- Every day, even on public holiday open, but closed on Good Friday.
- For more examples check out the evaluation tool and the documentation of opening_hours.js.
Summary syntax
This is a summary covering most cases. Its goal is to allow writing most opening hours tags in a short time, not to explain the full syntax. For more complicated cases, please refer to the text below this section, to the full specification and to more explanations.
You can check your compositions with the evaluation tool, or the simpler YoHours application.
- Legend
code
is either written literally as such (including a literal space separator- element is to be replaced by the element whose syntax is defined in a line starting by element: below;
- item... means that item can be repeated as needed.
- [ sequence of items ] means that the sequence of items is optional;
- | indicates that one of the sequences of items (separated by this symbol) must be chosen;
- General syntax
opening_hours=
rulesets [;
rulesets ]...- Each ruleset is evaluated in order, the next ruleset possibly overriding the initial open or closed state that may have been matched in the previous rulesets.
- rulesets: rule [
||
rule ]...- Each rule is evaluated in order until it matches for the indicated dates or times, otherwise the next rule in the ruleset will be checked only as a fallback.
- rule: range [ status ] [ comment ]
- range: [ years ] dates [
24/7
- Syntax for specifying optional years
- years: year_range [
,
year_range ]... - year_range: year [
-
year |+
] [/
n ]- An optional period of n years may be specified for years to include within the specified range starting at the first specified year.
- year: A 4-digit year number in the Gregorian calendar.
- Syntax for specifying dates (with optional times)
- dates: monthly | weekly | daily | variably | holidays
- monthly: monthdays [
- weekly: [
week
,
week_range ]...,
weekday_range ]... - daily: months [
,
monthdays ]... ] - variably: variable_date [
-
variable_date ] - months: Mth [
-
Mth ] - monthdays: dd [
-
dd ] - week_range: ww [
-
ww |+
] [/
n ]- An optional period of n weeks may be specified for weeks to include within the specified range starting at the first specified week number ww.
- weekdays: weekday_range [
,
weekday_range ]... | Wd[
n [,
n ]...]
- Week days may be followed by rank numbers, counted positively from the start of the month, or negatively from the end of month:
- e.g.
Mo-Fr 08:00-09:00
, orMo[1,3] 08:00-09:00
; - e.g.
Su[1]
means the first Sunday of the month, andSu[-1]
means the last Sunday of the month.
- weekday_range: Wd [
-
Wd ] - ww: A 2-digit week number (in ISO year) in range 01-53, e.g.
week 25 Mo 08:30-20:00
- dd: A 2-digit monthday number in range 01-31, e.g.
Dec 25
- Mth:
Jan
|Feb
|Mar
|Apr
|May
|Jun
|Jul
|Aug
|Sep
|Oct
|Nov
|Dec
- A 3-letter abbreviated English month name, e.g.
Dec 25
- A 3-letter abbreviated English month name, e.g.
- Wd:
Mo
|Tu
|We
|Th
|Fr
|Sa
|Su
- A 2-letter abbreviated English weekday name, e.g.
Fr 08:30-20:00
- A 2-letter abbreviated English weekday name, e.g.
- yearly_fest:
easter
- For now, the only variable yearly fest day specified is Easter (assuming the Christian Gregorian calendar).
- variable_date: yearly_fest [ sign n
days
], e.g.easter -2 days 08:00-17:00
for opening hours on Good Friday, oreaster +49 days 08:00-17:00
for opening hours on Whitsun/Pentecost. - holidays:
PH
|SH
- Public holiday (location dependent, requires data per country/region); scholar holiday (location dependent, requires data per scholar academy).
- Syntax for specifying times
- times: time_range [
,
time_range ]... - time_range: time [
-
time |+
]- This may be used in place of "late" or "until last customer", e.g.
12:00+
.
- This may be used in place of "late" or "until last customer", e.g.
- time: fixed_time | variable_time
- fixed_time: HH
:
mm - variable_time: event |
(
event offset_time)
- event:
dawn
|sunrise
|sunset
|dusk
- Note that sunset and sunrise times requires geolocation to compute the position angular elevation of the sun, and the the angular elevation of the observable horizon (which is also dependent of the altitude). They may be approximated at sea level on the modeling geoid, or just estimated roughly in local time (per country and time zone).
- offset_time: sign hh
:
mm - hh: A relative 2-digit hours number in range 00-48, e.g.
(sunrise+01:00)-12:00
. - HH: An absolute 2-digit hours number (in day, in 24 hour format, no am/pm) in range 00-23, e.g.
Fr 08:30-20:00
. - mm: A 2-digit minutes number (in hour) in range 00-59, e.g.
Fr 08:30-20:00
.
- Other generic syntaxic elements used for tuning dates and times
- sign:
+
|-
- n: A positive integer.
- Syntax for optional modifiers
- status:
unknown
|open
|closed
|off
unknown
: initial open or closed state, except at overriding dates and times that follow (may also be used to override a previous explicit open or closed status);open
: open at the indicated dates and times (or permanently if no time is given), except at overriding dates and times that follow;closed
oroff
: closed at the indicated dates and times (or permanently if no time is given), except at overriding dates and times that follow;- In each rule of the first ruleset of the tag value (including fallbacks), if the status is not explicitly specified with the specified range, it is assumed to be meant as
open
, leaving all other unspecified dates and times asunknown
; the resulting schedule is then successively modified by each following ruleset.
- comment:
"
text"
- A short comment (wrapped in
"
but not containing any"
within) showing applicable restrictions or specifications, e.g."children only"
,"limited service"
, or"reservation by phone"
. - This comment is intended to be displayed in applications and not to be interpreted automatically. The language used in this comment is not specified by the tag value itself, but this could be specified (for localisation purpose) by tags whose key contains a language code suffix.
- A short comment (wrapped in
Syntax
- wd weekday, available: Mo · Tu · We · Th · Fr · Sa · Su (e.g., > Fr 08:30-20:00)
- hh hour, always two digits number in 24 hour basis (no am/pm), in the format "hh:mm" · (e.g., > Fr 08:30-20:00)
- mm minute, always two digits number in the format "hh:mm" (e.g., > Fr 08:30-20:00)
- mo month, available: Jan · Feb · Mar · Apr · May · Jun · Jul · Aug · Sep · Oct · Nov · Dec · "mo md" (e.g., > Dec 25)
- md monthday, always two digits number in the format · "mo md" (e.g., > Dec 25)
- we week number, always a two digit number in range 01-53, in the format "week we" (e.g., > week 25 Mo 08:30-20:00)
- SH School Holiday, can be used to indicate different opening hours during school holidays (e.g., Mo-Fr 08:00-09:00,14:00-15:00; SH off)[1]
- PH Public Holiday, can be used to indicate different opening hours during public holidays (e.g., Mo-Fr 09:00-17:00; PH 10:00-12:00; PH Su off)[1]
- The above example means normal hours are Monday to Friday 9 am to 5 pm, except on public holidays it is 10 am to 12 pm, except public holidays that fall on a Sunday.
The general syntax for the value is: hh:mm-hh:mm (e.g., > 08:30-20:00).
The general syntax for the value is: wd hh:mm-hh:mm (e.g., > Fr 08:30-20:00).
The general syntax for the value is: mo md: hh:mm-hh:mm (e.g., > Dec 25: 08:30-20:00). Note that the colon is optional as mentioned under Key:opening_hours/specification.
The general syntax for the value is: mo-mo: wd hh:mm-hh:mm (e.g., Jun-Aug: Su 10:30-16:00 to specify the opening times on Sundays in June, July and August). Note that the colon is optional as mentioned under Key:opening_hours/specification.
The general syntax for the value is: week we: wd hh:mm-hh:mm (e.g., > week 25: Mo 08:30-20:00). Note that the colon is optional as mentioned under Key:opening_hours/specification.
Rules
- Consecutive hours [always needs open-close] separated by "-" · (e.g., > 08:30-20:00)
- Consecutive weekdays open separated by "-" · (e.g., > Mo-Fr)
- Consecutive monthdays open separated by "-" · (e.g., > Dec 20-26) or (e.g., > Dec 20-Jan 06)
- Open with periodicity "n" within a range of consecutive monthdays, the range is followed by "/n" (e.g., > 02-30/n)
- Consecutive weeks open separated by "-" · (e.g., > week 01-26)
- Open with periodicity "n" within a range of consecutive weeks, the range is followed by "/n" ( e.g.> week 02-52/n )
- A break on days separated by "," · (e.g., > Mo,We,Fr)
- A break on hours separated by "," · (e.g., > 08:30-14:00,16:30-20:00)
- Different hours on different days are separated by ";" (e.g., > Mo 10:00-12:00,12:30-15:00; Tu-Fr 08:00-12:00,12:30-15:00; Sa 08:00-12:00)
- reads as: this opening hours for this days ; this opening hours for this days
- A weekday off will be tagged as "wd off" (e.g., > Tu off)
- A range of weekdays off will be tagged as "wd-wd off" (e.g., > Tu-Th off)
- A month off will be tagged as "mo off" (e.g., > Aug off )
- A range of months off will be tagged as "mo-mo off" (e.g., > Aug-Sep off)
- A monthday off will be tagged as "mo md off" (e.g., > Dec 25 off)
- A range of monthdays off will be tagged as "mo md-md off" (e.g., > Dec 24-26 off) or "mo md - mo md off" (e.g., > Dec 25-Jan 06 off )
- Exceptions to a range of days, first the range then the exception (e.g., > Mo-Sa 10:00-20:00; Tu off) or (e.g., > Mo-Sa 10:00-20:00; Tu 10:00-14:00) or (e.g., > Mo-Fr 08:00-12:30; We 14:00-17:00)
- This means these are not additions, for example Mo-Fr 08:00-12:30; We 14:00-17:00 means that on Wednesdays, the shop is only opened in the afternoons and not additionally.
- If it is in the first or last day of a range then don't use the exception rule, use the usual (e.g., > Mo-Fr 10:00-20:00; Sa 10:00-14:00)
- Non-consecutive or semi-consecutive days of the week will be tagged as wd[x] (e.g., Su[3] 09:00-12:00)
- This is used to indicate the 3rd Sunday of the month from 9 am to 12 pm.
- Use -1 to indicate the last day of the month; e.g., Aug Th[-1] means last Thursday in August.
- Can use grouping, (e.g., Su[1,3,5] and Su[1-3])
- If hours are non stop some days then (e.g., > 00:00-24:00)
- If it is 24 hours 7 days a week it has a specific value: 24/7.
- This way it can render a specific icon.
- A special time value to mark the time the sun rises is: sunrise.
- A special time value to mark the time the sun sets is: sunset.
- A + after a time means "from" or "open end" (e.g., Sa 22:00+ or Sa 18:00-22:00+)
See the formal specification for more details.
Common mistakes
Incorrect | Correct | Notes |
---|---|---|
7/8-23 | Mo-Su 08:00-23:00 | |
0600-1800 | 06:00-18:00 | |
07;00-2;00pm | 07:00-14:00 | |
08.00-16.00, public room till 03.00 a.m | 08:00-16:00 open, 16:00-03:00 open "public room" | |
09:00-21:00 TEL/072(360)3200 | 09:00-21:00 "call us" | Add contact:phone=072-360-3200 |
10:00 - 13:30 / 17:00 - 20:30 | 10:00-13:30,17:00-20:30 | |
April-September; Mo-Fr 09:00-13:00, 14:00-18:00, Sa 10:00-13:00 | Apr-Sep: Mo-Fr 09:00-13:00,14:00-18:00; Apr-Sep: Sa 10:00-13:00 | |
Dining in: 6am to 11pm; Drive thru: 24/7 | 06:00-23:00 open "Dining in" || 00:00-24:00 open "Drive-through" | |
MWThF: 1200-1800; SaSu: 1200-1700 | Mo,We,Th,Fr 12:00-18:00; Sa-Su 12:00-17:00 | |
BAR: Su-Mo 18:00-02:00; Tu-Th 18:00-03:00; Fr-Sa 18:00-04:00; CLUB: Tu-Th 20:00-03:00; Fr-Sa 20:00-04:00 | Tu-Th 20:00-03:00 open "Club and bar"; Fr-Sa 20:00-04:00 open "Club and bar" || Su-Mo 18:00-02:00 open "bar" || Tu-Th 18:00-03:00 open "bar" || Fr-Sa 18:00-04:00 open "bar" | |
Su-Th 11:00-03:00; Fr-Sa 11:00-05:00 | Su-Th 11:00-03:00, Fr-Sa 11:00-05:00 | See last example |
Mo-We 17:00-01:00; Th,Fr 15:00-01:00; PH,Sa,Su off | Mo-We 17:00-01:00, Th,Fr 15:00-01:00; PH off | Use additional rules. You can not say "Sa,Su off" because that would set the time "Sa 00:00-01:00" to closed. |
Non-Gregorian Calendars
There has been some discussion about how to map non-Gregorian calendars (“Opening hours syntax for non Gregorian calendar”. 17 May 2019 .).
Implementation
JavaScript
JavaScript implementation by User:Ypid:
- Evaluation tool
- Source code
- Map showing elements with opening_hours
- Python script to search with regular expressions and to load values which could not be evaluated in JOSM (documentation in README).
- Does follow the formal specification originally created by Netzwolf.
- Based on initial coding and design done by AMDmi3.
Other implementations:
- Web to OSM Opening Hours - A tool for copy&pasting (almost) any website content and getting a decently formatted opening_hours-string. Contributions welcome on GitHub!
Java
- OpeningHoursParser Parser library
- OpeningHoursFragment Android OH editor library.
- opening-hours-evaluator Library to check if opening_hours are open at a certain time, uses OpeningHoursParser for parsing
PHP
- PHP code in SVN to parse opening_hours.
- Services_Openstreetmap, a PEAR PHP package for working with the OpenStreetMap (OSM) API, supports parsing a wide range of opening hours syntax - with examples here.
Python
- KOpeningHours Parser and validator
- pyopening_hours Wrapper for the javascript implementation
- humanized_opening_hours Translator to human description (unmaintained)
C++/Qt
- KOpeningHours Parsing, validation and evaluation (status at a certain time, iteration over intervals)
OsmAnd
OsmAnd uses this tag on the POI search screen. The implementation now includes more values (such as months and dates), added together with conditional restriction support.
Opening hours for Ulm, Neu-Ulm & surroundings
The web application is available on http://ulm-oeffnungszeiten.creal.de. Opening hours for the local area are visualized on a map. The source code of this application is freely licensed and available via GitHub. Adapting the application to a different city is very easy and described on the GitHub page.
More maps and applications
Web applications:
- openingh.openstreetmap.de / openingh.ypid.de, Map with layer for the tag opening_hours.
- Qwant Maps Search engine with OSM based map showing also opening hours of POI.
Mobile apps:
- My Opening Hours for Android devices
- Vespucci, full featured OSM editor for Android that includes special opening hours interface that includes support for highly complicated opening hours
- StreetComplete, newbie friendly OSM editor that allows to collect, among other data, opening hours information.
Tools:
- statistics Visualization of the data quality and growth over time.
- YoHours, a website to create opening hours simply by dragging time intervals on a calendar.
Rendering
In the case of 24/7, it can be something like adding a 24 to the object icon.
The rest of values have no obvious rendering and may be accessed with the context menu or alike.
- Maps showing opening hours:
Former deprecated tags
The following (undocumented) keys have been deprecated and should be replaced by this opening_hours=*. Their value should be interpreted to set the value of the new key, as described above:
See also conditional restrictions.
See also
- Openingh.openstreetmap.de — Tool for checking and evaluating opening_hours tags
- JOSM/Plugins/OpeningHoursEditor — A graphical editor for the opening_hours tag
- YoHours — Online editor for the tag syntax
- Conditional restrictions — Using opening_hours syntax for time-based conditions
- Relevant Sophox queries:
Similar tags
- opening_hours:office=*
- opening_hours:kitchen=*
- opening_hours:reception=*
- opening_hours:workshop=*
- opening_hours:atm=*
- opening_hours:drive_through=*
- opening_hours:covid19=*
- opening_hours:signed=no When the opening hours are not posted on a sign visible from outside
- collection_times=*
- service_times=*
- smoking_hours=*
- happy_hours=*
References
- ↑ 1.0 1.1 The default holidays can be added to opening_hours.js. There is an alternative system for default values which is currently not evaluated by opening_hours.js: Default is a proposal for a default values system. This proposal can set default values such as maxspeed for areas (countries, states, etc.), but also holidays periods. A country, a zone area can subscribe to a default containing such holidays definitions.