Day numbering in Yelp API

159 views Asked by At

When Yelp API returns data for each day of the week, like the hours when business is open, the first day is 0 and the last one is 6. Is it safe to assume that 0 corresponds to Sunday?

"hours": [
{
  "hours_type": "REGULAR",
  "open": [
    {
      "is_overnight": false,
      "end": "2200",
      "day": 0,
      "start": "1730"
    },
    {
      "is_overnight": false,
      "end": "2200",
      "day": 1,
      "start": "1730"
    },
    {
      "is_overnight": false,
      "end": "2200",
      "day": 2,
      "start": "1730"
    },
    {
      "is_overnight": false,
      "end": "2200",
      "day": 3,
      "start": "1730"
    },
    {
      "is_overnight": false,
      "end": "2200",
      "day": 4,
      "start": "1730"
    },
    {
      "is_overnight": false,
      "end": "2200",
      "day": 5,
      "start": "1730"
    },
    {
      "is_overnight": false,
      "end": "2200",
      "day": 6,
      "start": "1730"
    }
  ],
  "is_open_now": false
}

],

1

There are 1 answers

1
Yaman Jain On BEST ANSWER

Hope you are using latest api version (v3). you can refer to the yelp api documentation https://www.yelp.com/developers/documentation/v3/business which clearly says days 0-6 should be considered as monday to sunday

From the documentaion

hours[x].open[x].day int From 0 to 6, representing day of the week from Monday to Sunday. Notice that you may get the same day of the week more than once if the business has more than one opening time slots.