Announcements
Hi
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
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);
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
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.
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156