# Issue storing a date calculated using Javascipt to BDM Date-Time (no time zone)

**URL:** <https://community.ofelia.com/t/issue-storing-a-date-calculated-using-javascipt-to-bdm-date-time-no-time-zone/10868>\
**Category:** Q&A\
**Created:** [2 August 2021 14:34 UTC](https://community.ofelia.com/t/issue-storing-a-date-calculated-using-javascipt-to-bdm-date-time-no-time-zone/10868 "2021-08-02T14:34:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmartineau](https://avatars.discourse-cdn.com/v4/letter/d/ea666f/32.png) [@dmartineau](https://community.ofelia.com/u/dmartineau)\
**Post date:** [2 August 2021 14:34 UTC](https://community.ofelia.com/t/issue-storing-a-date-calculated-using-javascipt-to-bdm-date-time-no-time-zone/10868/1 "2021-08-02T14:34:34Z")

</div>

Hi Community,

We are using JavaScript on the form to calculate the next date and time based on a day of the week, hour and minute.

We are using the following function to calculate the next date.

> function getNextDate(startdate, nextDay, nextHour, nextMinute) {
> 
> &nbsp; &nbsp; var resultDate = new Date(startdate.getTime());
> 
> &nbsp; &nbsp; resultDate.setDate(startdate.getDate() + (7 + nextDay- startdate.getDay()) % 7);  
> &nbsp;&nbsp; &nbsp;resultDate.setHours(nextHour);  
> &nbsp;&nbsp; &nbsp;resultDate.setMinutes(nextMinute);  
> &nbsp;&nbsp; &nbsp;resultDate.setSeconds(0);  
> &nbsp;&nbsp; &nbsp;resultDate.setMilliseconds(0);  
> &nbsp;&nbsp; &nbsp;  
> &nbsp; &nbsp; return resultDate;  
> }

&nbsp;

The returned date is ok in GMT-4. How can we get the date calculated in GMT so that when it is saved in the BDM Date-Time (no time zone) it is impacted by the timezone.

&nbsp;

---

<div class="post-metadata">

**Author:** ![romain.bioteau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/romain.bioteau/32/720_2.png) [@romain.bioteau](https://community.ofelia.com/u/romain.bioteau)\
**Post date:** [3 August 2021 07:09 UTC](https://community.ofelia.com/t/issue-storing-a-date-calculated-using-javascipt-to-bdm-date-time-no-time-zone/10868/2 "2021-08-03T07:09:18Z")

</div>

Hi,

Did you have a look to [this thread](https://stackoverflow.com/questions/439630/create-a-date-with-a-set-timezone-without-using-a-string-representation/439871#439871) ?

I recommend using a `DATE-TIME (No Timezone)` type in your BDM to avoid dealing with this kind of timezone offsets issues (if it fits your use case ofc).

Using this type, you can post a ISO-8601 format string date like `2021-08-03T09:05:00` and ignore the timezone.

HTH  
Romain

---

<div class="post-metadata">

**Author:** ![dmartineau](https://avatars.discourse-cdn.com/v4/letter/d/ea666f/32.png) [@dmartineau](https://community.ofelia.com/u/dmartineau)\
**Post date:** [9 August 2021 13:25 UTC](https://community.ofelia.com/t/issue-storing-a-date-calculated-using-javascipt-to-bdm-date-time-no-time-zone/10868/3 "2021-08-09T13:25:45Z")

</div>

Hi Romain,

We are using the Date-Time (No Timezone). (question updated)

It looks like the timestamp is calculated properly&nbsp;but when the date is set using javascript&nbsp;in the UI designer, the widget does not trim the timezone.&nbsp;

What is the best way to get around this?

&nbsp;
