Skip to main content



No record found.

Dynamics 365 Community / Forums / Finance forum / UTC date conversion issue
Finance forum

UTC date conversion issue

Posted on by 643
I have a problem with getting utc dates from standard tables and putting them on custom ssrs report.
For example: when I get the date 25.01.2024 00:00:00 they always get the value minus two hours 24.01.2024 22:00:00.
Probably this is related to time from the server and time zone differences, but I can't deal with it to permanently solve this problem.
So far, I have tried converting in different directions:

Can anyone help?
  • Martin Dráb Profile Picture
    Martin Dráb 225,588 Super User on at
    UTC date conversion issue
    There is no thing like "the date reduced by two hours", because a date doesn't have a time. You must mean a datetime value. The value in database should be in UTC and you must use applyTimeZoneOffset() to convert it from UTC to user's timezone. But it's also possible that it's not in UTC because it was saved by buggy code. Check whether the value in DB is correct if applying the timezone doesn't work correctly.
  • Shooowtek Profile Picture
    Shooowtek 643 on at
    UTC date conversion issue
    Fields in the standard table are "FieldUTCDateTime", but my fields in the report class are of type "Date". 
    I getting the utcDateTime from the system and compare it with the date entered by the user. To do this, I convert date types “Date to utcDateTime using DateTimeUtil::newDateTime(date)

    The problem is that on the development machine everything works OK. But already on the test and production environment I get the date reduced by two hours.
  • Martin Dráb Profile Picture
    Martin Dráb 225,588 Super User on at
    UTC date conversion issue
    What is the type of the field? date or utcdatetime? You mentioned "UTC dates", which doesn't make a good sense, and your code seems to work with dates rather than utcdatetimes. On the other hand, 24.01.2024 22:00:00 isn't a date, it's date and time. But maybe you got that just because you're interpreting the date in a wrong way.
    If it's a date and you want to show it as a date, then forget the time part and all the conversions.
    It it's a utcdatetime, timezone handling is needed (and we'll discuss it in more details if needed).
    The first and the third of your conversions functions aren't useful in either case.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,989 Super User

Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans