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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

UTC date conversion issue

(1) ShareShare
ReportReport
Posted on by 845
Hi,
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:

DateTimeUtil::newDateTime(date)
DateTimeUtil::date(DateTimeUtil::applyTimeZoneOffset(utcDate,DateTimeUtil::getUserPreferredTimeZone()))
clrSystemDateTime2UtcDateTime(date)
 
Can anyone help?
I have the same question (0)
  • Martin Dráb Profile Picture
    239,592 Most Valuable Professional on at
    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.
  • Shooowtek Profile Picture
    845 on at
    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
    239,592 Most Valuable Professional on at
    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.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 677 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 620

#3
Subra Profile Picture

Subra 483

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans