# Date a day off

**URL:** <https://www.epiusers.help/t/date-a-day-off/106907>\
**Category:** Kinetic ERP\
**Tags:** baq, dashboard, customization, ubaq, e10, bpm\
**Created:** [September 11, 2023, 5:35pm UTC](https://www.epiusers.help/t/date-a-day-off/106907 "2023-09-11T17:35:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [September 11, 2023, 5:35pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/1 "2023-09-11T17:35:17Z")

</div>

I have a custom dashboard that is used to help populate UD09. One of the fields in UD09 is Date01. From my customization screen I used this code to assign a value to UD09.Date01 via callcontext.

```cs
edvCallContextBpmDataRow["Date01"] = MyDate.Text;

```

However, today we noticed that the date seems to be off. When I choose 9/8/23 as the date to enter into this field, the UBAQ saves it as 9/7/23. In the details I can see that it is using 9/7 at 11pm as the date. The date in the dashboard comes from the MyDate combo box. Which is setup as an EpiDateTimeEditor.

This is causing a problem where the user enters the date they want, and the system records a day earlier. I think it is due to the extra time information in the field. However, I can’t figure out how to get rid of it.  
I tried this approach on a suggestion from the AI.

```cs
DateTime dateValue;
if (DateTime.TryParse(MyDate.Text, out dateValue))
{
    edvCallContextBpmDataRow["Date01"] = dateValue;
}
else
{
    // Handle the case where MyDate.Text is not a valid date string
    // You can throw an exception, set a default value, or handle it in any other way.
    // I would probably assign the current system date here if the text was bad, or maybe prompt the user to check the date.
}

```

But this also returned the same date issue. For completeness, here is where I pull the value into my BPM:

```cs
MyDate = callContextBpmData.Date01;

```

And then assigning it to the new UD09 record:

```cs
ds.UD09[0].Date01 = callContextBpmData.Date01; 

```

This all works just fine except that the date is off. Is this the curse of DST? How can I resolve this issue?  
Thanks for your time!  
Nate

---

<div class="post-metadata">

**Author:** ![aosemwengie1](https://www.epiusers.help/user_avatar/www.epiusers.help/aosemwengie1/32/95533_2.png) [@aosemwengie1](https://www.epiusers.help/u/aosemwengie1)\
**Post date:** [September 11, 2023, 7:56pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/2 "2023-09-11T19:56:13Z")

</div>

Do you have a timezone assigned in site or company maintenance? I think I ran into this before but I can’t remember the exact details.

---

<div class="post-metadata">

**Author:** ![askulte](https://www.epiusers.help/user_avatar/www.epiusers.help/askulte/32/7325_2.png) [@askulte](https://www.epiusers.help/u/askulte)\
**Post date:** [September 11, 2023, 9:18pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/3 "2023-09-11T21:18:12Z")

</div>

> [@REST date/datetime bug reality check](https://www.epiusers.help/t/rest-date-datetime-bug-reality-check/104291/31):
>
> Yeah, still not what we wanted. But now at least it’s how it was before person_shrugging

---

<div class="post-metadata">

**Author:** ![Banderson](https://www.epiusers.help/user_avatar/www.epiusers.help/banderson/32/50875_2.png) [@Banderson](https://www.epiusers.help/u/Banderson)\
**Post date:** [September 11, 2023, 9:26pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/4 "2023-09-11T21:26:06Z")

</div>

We just updated, and they added a time zone… somehere… plant settings I think? And they didn’t populate it, we had to populate it, and it fixed some stuff like that.

I _think_ it was this one?

 ![image](https://www.epiusers.help/uploads/default/original/3X/0/6/06bbcb950ed371aafdac2d8e2828dd41713c0665.png)

---

<div class="post-metadata">

**Author:** ![pferrington](https://www.epiusers.help/user_avatar/www.epiusers.help/pferrington/32/9723_2.png) [@pferrington](https://www.epiusers.help/u/pferrington)\
**Post date:** [September 11, 2023, 9:29pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/5 "2023-09-11T21:29:40Z")

</div>

OK no idea if this will help but I have an untested theory. It sounds like some layer is treating that as a DateTime field not a date field. Date fields should not have time zones applied. I’m not sure this will work and in all fairness I’m hacking this over from a comment Olga shared with me about a simliar but different issue and could be misapplying it.

but I think the issue is the serialization of the data from the client to server and you do not what it to deal with time zones for this column. So try something like this:  
ds.UD09.Columns[“Date01”].DateTimeMode = DataSetDateTime.Unspecified;

that should tell the .net framework to not deal with time zone translations and keep your value unchanged.

Let me know if this works - I’m curious 🙂

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [September 12, 2023, 12:47pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/6 "2023-09-12T12:47:31Z")

</div>

> [@Banderson](#):
>
> they added a time zone

This seems like it is already correct for us.

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [September 12, 2023, 12:54pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/7 "2023-09-12T12:54:27Z")

</div>

> [@pferrington](#):
>
> ds.UD09.Columns[“Date01”].DateTimeMode = DataSetDateTime.Unspecified;

This exact line didn’t work. Errored with:  
CS1061 ‘IceColumn’ does not contain a definition for ‘DateTimeMode’ and no accessible extension method ‘DateTimeMode’ accepting a first argument of type ‘IceColumn’ could be found (are you missing a using directive or an assembly reference?)

Should that line of code go before or after I assign the date value to the column? I put it after in my test.

> [@aosemwengie1](#):
>
> Do you have a timezone assigned in site or company maintenance

I only see it in site maintenance and it is set correctly.

---

<div class="post-metadata">

**Author:** ![aosemwengie1](https://www.epiusers.help/user_avatar/www.epiusers.help/aosemwengie1/32/95533_2.png) [@aosemwengie1](https://www.epiusers.help/u/aosemwengie1)\
**Post date:** [September 12, 2023, 1:11pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/8 "2023-09-12T13:11:11Z")

</div>

When I ran into this before the problem was it was a date-time field and the timezone difference between the different sites caused it to shift to the wrong day, and unsetting the timezone fixed it. Probably not the right solution but it worked at the time.

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [September 12, 2023, 2:03pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/9 "2023-09-12T14:03:15Z")

</div>

> [@aosemwengie1](#):
>
> unsetting the timezone fixed it.

I tried this turning off the time zone in site maint, saving, then testing a few iteration, and then resetting the time zone. This did not change the functionality. I also have been trying to use the Infragistics.Win.TimeZoneInfo to modify the datetime before I save it. I have tried lines like this (based on suggestions from AI):

```cs
Infragistics.Win.TimeZoneInfo tzi = Infragistics.Win.TimeZoneInfo.FromStandardName("Eastern Standard Time");
DateTime localDate = tzi.ToLocalTime(MyDate.DateTime.Date);
edvCallContextBpmDataRow["Date01"] = localDate;

```

For this code, when I choose 9/8/23, it returns 9/7 7pm. Weird right?

```cs
edvCallContextBpmDataRow["Date01"] = MyDate.DateTime.Date;

```

and for this code when I input 9/8, it returns 9/7 11pm.

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [September 12, 2023, 2:13pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/10 "2023-09-12T14:13:02Z")

</div>

I was originally thinking I had to update my BPM to modify the value I am pulling from the callcontext. But now I think I need to get the dashboard to output the correct date. I am not sure which is the best way to approach it, but my thinking is that I want the data correct as soon as possible. If I can get the right date in the dashboard, then it should not need any changes in the BPM.

---

<div class="post-metadata">

**Author:** ![pferrington](https://www.epiusers.help/user_avatar/www.epiusers.help/pferrington/32/9723_2.png) [@pferrington](https://www.epiusers.help/u/pferrington)\
**Post date:** [September 12, 2023, 2:27pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/11 "2023-09-12T14:27:47Z")

</div>

It is a System.Data.DataSet property not a tableset property. I was thinking in terms of hte classic client.

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [September 12, 2023, 2:30pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/12 "2023-09-12T14:30:49Z")

</div>

How does that change the code you posted?

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [September 12, 2023, 3:25pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/13 "2023-09-12T15:25:32Z")

</div>

> [@NateS](#):
>
> `MyDate.DateTime.Date`

I did a MessageBox.Show on this value directly from the dashboard before BPM gets ahold of it. When I enter 9/8, it returns 9/8 12:00, just as expected. But by the time it gets pulled into the BPM the time offset takes place, returning 9/7 11pm.

And a MessageBox from my BPM shows: CallContextBpmData.Date01: \<callContextBpmData.Date01/\>  
as 9/7 11pm.

---

<div class="post-metadata">

**Author:** ![Banderson](https://www.epiusers.help/user_avatar/www.epiusers.help/banderson/32/50875_2.png) [@Banderson](https://www.epiusers.help/u/Banderson)\
**Post date:** [September 12, 2023, 3:44pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/14 "2023-09-12T15:44:04Z")

</div>

Is your server and your client in the same time zone?

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [September 12, 2023, 3:49pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/15 "2023-09-12T15:49:18Z")

</div>

🤔 I think our server is central. That is what is in the server address line. We are Eastern, so there certainly is an hour difference. I can’t tell where the conversion is happening based on the last post.

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [September 12, 2023, 5:46pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/16 "2023-09-12T17:46:59Z")

</div>

After thorough debugging, the conversion must happen between the dashboard customization and the BPM. Everything on the dashboard side returns the correct date, and everything on the BPM side returns the wrong date. For example, poking the call context from the dashboard, both of these calls return the correct date:

```cs
MessageBox.Show(MyDate.DateTime.Date.ToString());
edvCallContextBpmDataRow["Date01"] = MyDate.DateTime.Date;
MessageBox.Show(edvCallContextBpmDataRow["Date01"].ToString());

```

However, when I am in the BPM, if I pull the callcontext into a message box, it has the wrong date. If I use that callcontext to assign the date to any other variable, then obviously that variable is wrong.

I am convinced this must be due to the difference in local and server time. I just don’t know what to do about it. I worry that if I make a custom workaround (say to add a few hours to the datetime to bring it up to the date that was chosen), then Epicor will change something again and break it. There must be a “correct” way to do this, right?

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [September 12, 2023, 6:12pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/17 "2023-09-12T18:12:57Z")

</div>

GPT sugggested a novel solution… that didn’t work either:

```cs
MessageBox.Show(MyDate.DateTime.Date.ToString());
// Assume formDate is the DateTime object you got from your form
DateTime formDate = MyDate.DateTime.Date;
// Create a new DateTime with only the date part and time set to midnight
DateTime myDate = new DateTime(formDate.Year, formDate.Month, formDate.Day);
// Save the date to Date01 field
edvCallContextBpmDataRow["Date01"] = myDate;
MessageBox.Show(myDate.ToString());
MessageBox.Show(edvCallContextBpmDataRow["Date01"].ToString());

```

The way this is built up piece by piece is a good idea, and the message boxes (in the dashboard) all return the correct date. But, as soon as the date gets into the BPM, the message boxes (in the BPM) begin returning the wrong date.

Interestingly, all three messageboxes from the dashboard returned a date with a time component. They all said 9/8/23 12:00 🤔

---

<div class="post-metadata">

**Author:** ![aosemwengie1](https://www.epiusers.help/user_avatar/www.epiusers.help/aosemwengie1/32/95533_2.png) [@aosemwengie1](https://www.epiusers.help/u/aosemwengie1)\
**Post date:** [September 12, 2023, 6:26pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/18 "2023-09-12T18:26:56Z")

</div>

What happens if you switch your computer to the timezone of the server?

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [September 12, 2023, 6:32pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/19 "2023-09-12T18:32:32Z")

</div>

> [@aosemwengie1](#):
>
> What happens if you switch your computer to the timezone of the server?

This still gives the same results. I can see the time on my PC is now 1:30 instead of 2:30, but the dashboard still returns all 9/8/23 12:00 and the BPM still returns 9/7/23 11:00. I didn’t think I could change the timezone on my PC as it should be managed by our MSP. It was pretty easy to change for a test, however it didn’t help. ☹

---

<div class="post-metadata">

**Author:** ![hkeric.wci](https://www.epiusers.help/user_avatar/www.epiusers.help/hkeric.wci/32/52019_2.png) [@hkeric.wci](https://www.epiusers.help/u/hkeric.wci)\
**Post date:** [March 13, 2024, 10:12pm UTC](https://www.epiusers.help/t/date-a-day-off/106907/20 "2024-03-13T22:12:51Z")

</div>

Odd @julieb just asked me to look at this exact issue she has with her. Its as you described it, everything in the BPM is fine, the UI just changes if there is a Timezone issues.

Did you ever resolve it?

Also are you running Citrix by any chance?

[Next page](https://www.epiusers.help/t/date-a-day-off/106907.md?page=2)
