# Time Zone Conversion

1. Time Zone Conversion Target Object
  There are 3 APIs involved in time zone handling:
  Get information of a Merchantservices.serviceHoursavailabilitiesNew Merchant Update Notificationservices.serviceHoursavailabilitiesGet Merchant Status and Service Hoursservices.serviceHours 2. Time Zone Conversion Rules
  (1) All time-related fields in the documentation are transmitted in the UTC+0 time zone.
  (2) The value in timePeriods should always conform to the rule: endTime > startTime.
  (3) If the time spans a day after conversion to the UTC+0 time zone, it should be split into two parts.
  (4) 24:00 should be transmitted as: 23:59:00.000Z. 3. Time Zone Conversion ExamplesTake Brazil's official time zone UTC-3 as an example.
 3.1 [ data + timePeriod ] combination scenario (1) The conversion to UTC+0 will not cross the day
  If the local time is: **2024-04-07 08:00-20:00**, the format transmitted in the API should be (after converting to UTC+0):

```
[
  {
    "date": "2021-04-07",
    "timePeriods": {
        "startTime": "11:00:00.000Z",
        "endTime": "23:00:00.000Z"
    }
  }
]
```
 (2) The conversion to UTC+0 will cross the day
  If the local time is: **2024-04-07 10:00-22:00**, the format transmitted in the API should be (after converting to UTC+0):

```
[
  {
    "date": "2021-04-07",
    "timePeriods": {
        "startTime": "13:00:00.000Z",
        "endTime": "23:59:00.000Z"
    }
  },
  {
    "date": "2021-04-08",
    "timePeriods": {
        "startTime": "00:00:00.000Z",
        "endTime": "01:00:00.000Z"
    }
  }
]
```
 3.2 [ dayOfWeek + timePeriod ] combination scenario (1) The conversion to UTC+0 will not cross the day
  If the local time is: **Monday & Tuesday 08:00-20:00**, the format transmitted in the API should be (after converting to UTC+0):

```
[
  {
    "dayOfWeek": [
        "MONDAY",
        "TUESDAY"
    ],
    "timePeriods": {
        "startTime": "11:00:00.000Z",
        "endTime": "23:00:00.000Z"
    }
  }
]
```
 (2) The conversion to UTC+0 will cross the day
  If the local time is: **Monday & Tuesday 10:00-22:00**, the format transmitted in the API should be (after converting to UTC+0):

```
[
  {
    "dayOfWeek": [
        "MONDAY"
    ],
    "timePeriods": {
        "startTime": "11:00:00.000Z",
        "endTime": "23:59:00.000Z"
    }
  },
  {
    "dayOfWeek": [
        "TUESDAY"
    ],
    "timePeriods": {
        "startTime": "00:00:00.000Z",
        "endTime": "01:00:00.000Z"
    }
  },
  {
    "dayOfWeek": [
        "TUESDAY"
    ],
    "timePeriods": {
        "startTime": "11:00:00.000Z",
        "endTime": "23:59:00.000Z"
    }
  },
  {
    "dayOfWeek": [
        "WEDNESDAY"
    ],
    "timePeriods": {
        "startTime": "00:00:00.000Z",
        "endTime": "01:00:00.000Z"
    }
  }
]
```
Finally merge into:

```
[
  {
    "dayOfWeek": [
        "MONDAY",
        "TUESDAY"
    ],
    "timePeriods": {
        "startTime": "11:00:00.000Z",
        "endTime": "23:59:00.000Z"
    }
  },
  {
    "dayOfWeek": [
        "TUESDAY",
        "WEDNESDAY"
    ],
    "timePeriods": {
        "startTime": "00:00:00.000Z",
        "endTime": "01:00:00.000Z"
    }
  }
]
```

