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

get User time instead of system time

(0) ShareShare
ReportReport
Posted on by 206

Hi .

I am facing an issue in which my dev box run at australian time zone and I am testing the code from indian time zone , so the requirement is such that we need to get the user time zone instead of getting system time zone .... I know I can get system date time by using getSystemDateTime() .but how to get the local current time zone in with the user is testing .In simple words I want to get windows time whatever is there .

8255.pastedimage1621587010432v1.png

I have the same question (0)
  • nmaenpaa Profile Picture
    101,172 Moderator on at

    Hi Nishi,

    is this question about Dynamics AX 2012 (you posted on AX forum) or D365 F&O?

    In most cases you don't need to care about the system (server) timezone at all.

    First of all, all timestamps from user transactions are stored as UTC time in the database. 

    Second, every user defines their time zone in the Dynamics user setup. This setting determines how the UTC timestamps from the database are displayed to the user. And how user's datetime inputs are converted to UTC before storing to database. You can also change the time zone there if you want to test as if you were on a different time zone.

    If you need any more help, please let us know what Dynamics product you're talking about, and also please describe all details that you can about your actual test case, and functional requirement. Thanks!

  • Martin Dráb Profile Picture
    239,634 Most Valuable Professional on at

    Which version of AX is it about?

    In general, the time on the local machine isn't relevant. What counts are two things: system time and user's timezone. If user's timezone is the same as timezone on the local machine, you'll get the local time. But users will get time in their timezone even if a wrong timezone is set up in Windows.

    You can also easily test various timezones by changes user settings, completely ignoring what timezone is configured in Windows.

  • Nishi Gupta Profile Picture
    206 on at

    D365Fo .The requirement is that we need to do a naming convention for reports in which timestamp needs to be added on the name of the report .for Ex. SalesInvoice_20210521141900 (taking reference of above image) . but when we run the report we get the timestamp of the system. This is creating confusion for the user as he is not getting the right time at which he is generating the report.

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

    Moved to D365 Finance forum.

    You can use UserInfo.PreferredTimeZone field to find out user's timezone. And then you can convert the UTC timestamp to local time for that timezone.

    However please take into account that if you don't put absolute (UTC) timestamp in the filename, then the files will not be sorted correctly (chronologically), and the names can even be confusing if users from many time zones are creating them.

  • Suggested answer
    Nishi Gupta Profile Picture
    206 on at

    the legal entity didnt have the correct timezone set , which led to all these problems .

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
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 802

#2
André Arnaud de Calavon Profile Picture

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

#3
Subra Profile Picture

Subra 534

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans