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, ...
Suggested Answer

utcDateTime issue

(0) ShareShare
ReportReport
Posted on by 75

FO form data

pastedimage1677836150902v1.png

I need same dates but when running following code in runnable class

select hRMRecruitingTable
            where hRMRecruitingTable.hrmRecruitingId == 'FA'
            && hRMRecruitingTable.kSPEndDateTime >= DateTimeUtil::applyTimeZoneOffset(hRMRecruitingTable.kSPEndDateTime, DateTimeUtil::getUserPreferredTimeZone());

        info(strFmt("%1, %2" ,hRMRecruitingTable.kSPEndDateTime 
            ,DateTimeUtil::applyTimeZoneOffset(hRMRecruitingTable.kSPEndDateTime, DateTimeUtil::getUserPreferredTimeZone())));

I got 2 different dates

pastedimage1677835984517v1.png

Any solution?

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    238,740 Most Valuable Professional on at

    That's the expected behaviour. One value is in UTC and one in user preferred timezone. They'll be the same only if the current timezone offset of user preferred timezone is zero.

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi Ashraf, In addition to Martin's response, you can check this thread as well. Martin has explained in detail

    community.dynamics.com/.../utcdatetime-and-timezone-offsets

  • Ashraf_ahk Profile Picture
    75 on at

    I resolved the issue by using following techniques:

    1:Functional

    Set Time Zone

    OMLegalEntities

    SysUserSetup

    2:Technical

    utcdatetime currentDateTime = DateTimeUtil::getSystemDateTime();
    
    select hRMRecruitingTable
                where hRMRecruitingTable.hrmRecruitingId == 'FA'
                && hRMRecruitingTable.kSPEndDateTime >= currentDateTime;
    
            info(strFmt("%1, %2" ,hRMRecruitingTable.kSPEndDateTime 
                ,DateTimeUtil::applyTimeZoneOffset(hRMRecruitingTable.kSPEndDateTime, DateTimeUtil::getUserPreferredTimeZone())));

    Set FormDateTimeControl property -> Timezone Preference: User

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 309

#3
Diego Mancassola Profile Picture

Diego Mancassola 259

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans