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

SQL VS NAV TIME DIFFERENCE

(0) ShareShare
ReportReport
Posted on by 100

SQLvsNAVtimeDiff.bmpHi

I have nav database with BC spring 

Actually I am pulling some data from another database to NAV database using SQL query

It is showing correct date-time in SQL list but the same table in nav is showing different time

Please find attached document and advice

Warm Regards

Krishna

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,162 Most Valuable Professional on at
    RE: SQL VS NAV TIME DIFFERENCE

    When you perform the INSERT into the NAV table, you need to convert the datetime value to UTC and save the UTC value to the NAV datetime field.

    You can do as follows in T-SQL to convert a datetime to UTC:

    SELECT DATEADD(second, DATEDIFF(second, GETDATE(), GETUTCDATE()), YOUR_DATE);

  • KrisMuthy Profile Picture
    100 on at
    RE: SQL VS NAV TIME DIFFERENCE

    Ok but

    In SQL server the date and time ok.  

    when open nav table the data shows dfferent

    SELECT column_name,DATEADD(mi, DATEDIFF(mi, GETUTCDATE(), GETDATE()), column_name)  AS ColumnInLocalTime from table1

    the above query good  and working fine

    but in NAV I am getting time is wrong

    Warm regards

    Kris

  • Christian Mendoza Profile Picture
    20 on at
    RE: SQL VS NAV TIME DIFFERENCE

    Hi

    As i mention before, "The reason is that a datetime in SQL is saved as a universal time that also includes the timezone. The date in NAV shows the datetime in your timezone."

    This is according to server configuration, but you can try do this:

    SELECT column_name,DATEADD(mi, DATEDIFF(mi, GETUTCDATE(), GETDATE()), column_name)  AS ColumnInLocalTime from table1

    With this query, you can see the correct time (local)

    Christian Mendoza.

    Best regards.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,865 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,723 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans