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 :
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,794 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,165 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,794 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,794 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,794 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,417 Super User 2026 Season 1 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

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,926 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,158 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 533 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans