# What can I use to determine today's UTC time period provided today is 2017-11-17 Pacific?

**URL:** <https://community.postman.com/t/what-can-i-use-to-determine-todays-utc-time-period-provided-today-is-2017-11-17-pacific/281>\
**Category:** Help Hub\
**Tags:** day, utc, time, conversion, startend\
**Created:** [November 17, 2017, 11:45pm UTC](https://community.postman.com/t/what-can-i-use-to-determine-todays-utc-time-period-provided-today-is-2017-11-17-pacific/281 "2017-11-17T23:45:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![TienLeCarlsbad](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@TienLeCarlsbad](https://community.postman.com/u/TienLeCarlsbad)\
**Post date:** [November 17, 2017, 11:45pm UTC](https://community.postman.com/t/what-can-i-use-to-determine-todays-utc-time-period-provided-today-is-2017-11-17-pacific/281/1 "2017-11-17T23:45:25Z")

</div>

Problem Statement:  
Given DAY, i.e. (time zone: Pacific) 2017-11-17, need a converter to produce UTC time period for telemetry reading, i.e. start=2017-11-17T08:00:00.000000Z&end=2017-11-18T07:59:59.999999Z.

Is there such a formula or method to do this?

Thanks in advance for your help!  
Tien.

---

<div class="post-metadata">

**Author:** ![akshaybist](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/akshaybist/32/94_2.png) [@akshaybist](https://community.postman.com/u/akshaybist)\
**Post date:** [November 21, 2017, 2:38am UTC](https://community.postman.com/t/what-can-i-use-to-determine-todays-utc-time-period-provided-today-is-2017-11-17-pacific/281/2 "2017-11-21T02:38:51Z")

</div>

You can require [moment](https://momentjs.com/docs), which is available in the [Postman Sandbox](https://www.getpostman.com/docs/postman/scripts/postman_sandbox_api_reference) for this.

This pre-request script should work

```javascript
const moment = require('moment');

const today = moment();

pm.globals.set('startDayUTC', today.startOf('day').toISOString());
pm.globals.set('endDayUTC', today.endOf('day').toISOString());

```

This will pick the local timezone of the computer running the collection. If you want to force to PST, then initialize `today` like so

```javascript
const today = moment().zone(420); // PST offset from UTC in minutes

// Or for UTC
const today = moment.utc();

```

More on setting timezone offset in moment [here](https://momentjs.com/docs/#/manipulating/timezone-offset/)

---

<div class="post-metadata">

**Author:** ![TienLeCarlsbad](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@TienLeCarlsbad](https://community.postman.com/u/TienLeCarlsbad)\
**Post date:** [November 22, 2017, 5:09am UTC](https://community.postman.com/t/what-can-i-use-to-determine-todays-utc-time-period-provided-today-is-2017-11-17-pacific/281/3 "2017-11-22T05:09:50Z")

</div>

Thank you for your help, Akshay. I will check this out!! And update the post accordingly.

Thanks,  
Tien

---

<div class="post-metadata">

**Author:** ![TienLeCarlsbad](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@TienLeCarlsbad](https://community.postman.com/u/TienLeCarlsbad)\
**Post date:** [March 8, 2018, 12:25am UTC](https://community.postman.com/t/what-can-i-use-to-determine-todays-utc-time-period-provided-today-is-2017-11-17-pacific/281/4 "2018-03-08T00:25:00Z")

</div>

works awesome as I finally got around to making use of this !!

---

<div class="post-metadata">

**Author:** ![TienLeCarlsbad](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@TienLeCarlsbad](https://community.postman.com/u/TienLeCarlsbad)\
**Post date:** [March 8, 2018, 12:28am UTC](https://community.postman.com/t/what-can-i-use-to-determine-todays-utc-time-period-provided-today-is-2017-11-17-pacific/281/5 "2018-03-08T00:28:04Z")

</div>

thanks again, Akshay.

---

<div class="post-metadata">

**Author:** ![Chris](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/chris/32/6637_2.png) [@Chris](https://community.postman.com/u/Chris)\
**Post date:** [March 8, 2018, 12:37am UTC](https://community.postman.com/t/what-can-i-use-to-determine-todays-utc-time-period-provided-today-is-2017-11-17-pacific/281/6 "2018-03-08T00:37:42Z")

</div>

@akshaybist, the real MVP.

---

<div class="post-metadata">

**Author:** ![TienLeCarlsbad](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@TienLeCarlsbad](https://community.postman.com/u/TienLeCarlsbad)\
**Post date:** [March 8, 2018, 3:59am UTC](https://community.postman.com/t/what-can-i-use-to-determine-todays-utc-time-period-provided-today-is-2017-11-17-pacific/281/7 "2018-03-08T03:59:03Z")

</div>

J

Thanks, Chris.

Tien
