Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Converting a DateTime to a Date via SQL

Posted on by Microsoft Employee

I have a Table with a DateTime field . I want to populate another Field with just the Date. Via SQL How Can I Do this?  

UPDATE dbo.[TIOGA$Service Desk]
SET [Resoloution Date] = [Resoloution Date Time]

Below is the field names, how can I write this? 

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Converting a DateTime to a Date via SQL

    Thank you for the reply, it was very useful.

    I also found this to do the job for me, however it is a worse way of doing it.. 

    UPDATE dbo.[Service Desk]
    SET [Resoloution Date] = CONVERT(date, [Resolution Date Time], 3)
    WHERE [Resolution Date Time] != '1753-01-01 00:00:00.000'

  • Verified answer
    Binesh Profile Picture
    Binesh 7,885 on at
    RE: Converting a DateTime to a Date via SQL

    Hello Lewis,

    Before assign you have to convert, see bellow:

    SET [Resoloution Date] = CONVERT(VARCHAR(10), [Resoloution Date Time], 111)

    NOTE: Based on your format change the last parameter. see the screenshot, HERE GETDATA() returns the current datetime

    4454.12.png

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans