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 :
Small and medium business | Business Central, N...
Suggested Answer

How to display today date from online server

(0) ShareShare
ReportReport
Posted on by 822

Hello,

can anybody help me in writing a codeunit to display current date from online server?

Regards,

David

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Hi,

    What do you mean by Online server?

    You can use WORKDATE or Today to get the current date

    Thanks

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    Use the today method as documented here:

    learn.microsoft.com/.../system-today-method

  • David Tailor Profile Picture
    822 on at

    hello,

    thank you for your answers, however i have a requirement to display today date not from the system but from online server.

    Regards,

    David

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    which version you are using? On Cloud or OnPrem?

  • David Tailor Profile Picture
    822 on at

    On cloud.

    but it can works on both right?

    Regards,

    David

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    can you please share your code? where you want to display?

  • David Tailor Profile Picture
    822 on at

    there is no code. if you can help me with a code like Hello world standard of VS code.

    a page extension or a codeunit that will be called on any page extension.

    we can extend Customer List page

    Regards,

    David

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Please refer the below link, surely it will help you.

    learn.microsoft.com/.../devenv-page-ext-object

  • Suggested answer
    DAnny3211 Profile Picture
    11,397 on at

    hi

    try this:

    codeunit 50100 DisplayCurrentDate

    {

       procedure GetDate()

       var

           CurrentDate: Date;

       begin

           CurrentDate := SYSTEMTIME2DATE(CURRENTDATETIME);

           MESSAGE('The current date is %1.', CurrentDate);

       end;

    }

    This codeunit contains a procedure called "GetDate" that retrieves the current date and time from the online server using the "CURRENTDATETIME" function. The "SYSTEMTIME2DATE" function is then used to convert the date and time to a date value.

    check my answer if it helped you, thanks

    DAniele

  • David Tailor Profile Picture
    822 on at

    Hi Daniele,

    i receive an error for the function SYSTEMTIME2DATE :

    "the name does not exist"

    Regards,

    David

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans