# To verify that time\_utc in my response is incrementing by 1 hour for 8 days

**URL:** <https://community.postman.com/t/to-verify-that-time-utc-in-my-response-is-incrementing-by-1-hour-for-8-days/21812>\
**Category:** Help Hub\
**Created:** [March 25, 2021, 1:15am UTC](https://community.postman.com/t/to-verify-that-time-utc-in-my-response-is-incrementing-by-1-hour-for-8-days/21812 "2021-03-25T01:15:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nithiyasuresh](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@nithiyasuresh](https://community.postman.com/u/nithiyasuresh)\
**Post date:** [March 25, 2021, 1:15am UTC](https://community.postman.com/t/to-verify-that-time-utc-in-my-response-is-incrementing-by-1-hour-for-8-days/21812/1 "2021-03-25T01:15:47Z")

</div>

I am trying to write a test to verify that in my response, the time\_utc is incrementing by 1 hour for every array and i am expecting to see for 8 days.

As of now my console is giving my for only 24 hours.  
Need help to clean up the script.

Below is the response body i am trying to acheive, when i write the script:

```auto
"date": "2021-03-25",
            "1hourly": [
                {
                    "time_utc": "2021-03-24T23:00:00Z",
                    "atm": {
                        "surf_air": {
                            "temp_apparent_cel": null,
                            "temp_dew_pt_cel": null,
                            "temp_cel": null,
                            "hum_relative_percent": null,
                            "wind": {
                                "hazardous_onset_code": null,
                                "dirn_10m_deg_t": null,
                                "speed_10m_avg_mps": null,
                                "gust_speed_10m_max_mps": null,
                                "mixing_height_m": null
                            }
                        }
                    }
                },
                {
                    "time_utc": "2021-03-25T00:00:00Z",
                    "atm": {
                        "surf_air": {
                            "temp_apparent_cel": null,
                            "temp_dew_pt_cel": null,
                            "temp_cel": null,
                            "hum_relative_percent": null,
                            "wind": {
                                "hazardous_onset_code": null,
                                "dirn_10m_deg_t": null,
                                "speed_10m_avg_mps": null,
                                "gust_speed_10m_max_mps": null,
                                "mixing_height_m": null
                            }

```

Postman script written as below:

```auto
  for(var i = 0; i < forecast.length; i++)
   {
       pm.expect(forecast[i]).to.have.property('date');
       pm.expect(forecast[i]).to.have.property('1hourly');
       
       var one_hourly = forecast[i]["1hourly"];
       
       for(var k = 0; k < one_hourly.length; k++)
       {
           console.log(one_hourly)
           //the difference between start and end time should be 1 hour as it is 1hourly forecast
           var start_time_utc = moment(one_hourly[k].time_utc);
           var end_time_utc = moment(one_hourly[k+1].time_utc);

           console.log(start_time_utc, end_time_utc);

           var duration = moment.duration(end_time_utc.diff(start_time_utc)).asHours();
           console.log (duration);
           pm.expect(duration).to.eql(1);

```
