web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Dual Write : Time discrepancy

(0) ShareShare
ReportReport
Posted on by 901

Hi all,

I have a PowerApps with Dataverse having a Dual-Write mechanism to F&O. Strange thing happened that when I input my data, like today just now because I'm in GMT+8 Timezone, it is recorded in Dataverse as 10/26/2021 4:30 PM.

But when reach F&O, it was recorded as 10/25/2021 ( I cannot determined the time recorded as in SQL Server also stated as 00:00:00).

Anyone has this kind of experience and how to resolved it.

Thanks in advance.

I have the same question (0)
  • Tony zhong Profile Picture
    901 on at

    Is there by any chance, this is because UTC issue?

    I'm actually not sure what I've been talking, but just saying, for example when we import Data (using DIXF) is there something need to handle about the source data when having dates coz probably they're not from same timezone ? or our F&O server (environment) is not in the same Timezone.

    Just thinking out loud.

    Thanks

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Since most date fields are stored as DateTime under the hood, the actual stored value is something like 26.10.2021 00:00 (your time zone). If someone views it on a different time zone, it can be displayed as 25.10.2021. This can cause issues with things like birthdays.

    You can check the stored UTC timestamp in D365 database. Also check your D365 user's timezone setting - perhaps it's set to UTC instead of your actual timezone and that's why it's displayed incorrectly.

    We had to work around the "birthday issue" in some integration project (not Dual-Write) by storing the values in format 25.10.2021 12:00 PM (noon) instead of the default 12:00 AM (midnight). This way the date part would be the same on all time zones.

  • Tony zhong Profile Picture
    901 on at

    Hi Nikolaos,

    How to check Datetime under the hood ? If by checking the field trough SQL Server, it is 00:00:00 for the time.

    Btw, I just do another test, as this is Dual Write, if I create from F&O, both (F&O and Dataverse) is correct, so the problem is when the data imported /  comes in, somehow F&O changed it, but still not sure why and how since I cannot see the timestamp.

    Thanks

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    By "under the hood" I mean the database, yes. So it seems that the timestamp is stored 26.10.2021 00:00:00 in the database. This is UTC time.

    Now, if your timezone is let's say UTC -5, then the same timestamp is displayed 25.10.2021 19:00:00.

    If you create something manually in D365, then it's stored as 26.10.2021 00.00:00 in your user's time zone, not UTC.

    Perhaps these details help you determine how you could possibly solve it.

  • Tony zhong Profile Picture
    901 on at

    Hi Nikolaos,

    I'm sorry I think I lost you. Understood about the 1st sentence, as it is what I found in AxDB. But for the timezone, is this in the F&O server ? or in dataverse environment ? and the timestamp displayed on where exactly ?

    When you said "create something manually in D365", you are referring to D365 F&O or CE by mean Dataverse ?

    As this is only happened when data "incoming", do you mean I should handle it by writing code in data entity for the incoming procedure ?

    Thanks

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    The timestamp that you see in the database is UTC. How it's displayed in different places depends on your user's timezone.

    By "create something manually" I meant in D365 F&O. 

    And yes, you might be able to adjust the timestamp during the import by writing code in the entity. I you just set the "00:00" UTC into "12:00" UTC then it should display correctly on any timezone.

  • Tony zhong Profile Picture
    901 on at

    Hi Nikolaos,

    Noted. However I'm not really familiar about Data Entity stuff, would you mind to suggest on which method I should put this code ? Is the PostLoad suitable for this action ?

    Is there any sample data entity that using this kind of code?

    Thanks

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    PostLoad is used in export, you should use mapEntityToDataSource method. You can find an example here: docs.microsoft.com/.../data-entity-computed-columns-virtual-fields

  • Tony zhong Profile Picture
    901 on at

    Hi Nikolaos,

    Probably need a little help here.

    FYI, I'm in GMT 8, right now and at the time I' m inserting a new record in dataverse is '2021-10-27 01:00:00 PM'

    So at first I'm trying this ->

    utcdatetime convertedProjectDate = DateTimeUtil::newDateTime(this.ProjectDate, 0, DateTimeUtil::getCompanyTimeZone());
    
    this.ProjectDate = DateTimeUtil::date(convertedProjectDate);

    This resulted a very weird date in F&O which is '2021-10-24', I don't know what is the logic to come up with that.....

    .. so 2ndly, I'm trying this ->

    utcdatetime convertedProjectDate = DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::newDateTime(this.ProjectDate,0), DateTimeUtil::getUserPreferredTimeZone());
    
    this.ProjectDate = DateTimeUtil::date(convertedProjectDate);

    This is better, but will make it the same as the original issue, which is result '2021-10-26'

    I debug this, and in MapEntityToDataSource, the "this.ProjectDate" already with '2021-10-26', so it looks like it is already false at this stage. In the Watch screen, the value become '2021-10-26 08:00:00', so when it looks like "comes in" false :'2021-10-26 00:00:00' then the logic add it by my timezone GMT 8

    At which stage I can see the original value from the source ? which supposed to be '2021-10-27 01:00:00 PM' ?

    Btw, the "ProjectDate" in that Data Entity is directly map in Dual-Write configuration to my field in Dataverse, which is correct as I insert data 1st time as mentioned.

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans