Sql server strip time from datetime
For SQL Server +, you can CAST to date. Or just use date so no time to remove. Edit, Jan A worked example of how flexible this is. Personally, I'd return the full, native datetime value and format this in the client code. For more info refer this: SQL Server Date Formats. dirtylesbo.info In your case you can use. SELECT CONVERT(VARCHAR(10), GETDATE(), ) AS. Jun 09, · Try the TimeOnly function from Essential SQL Server Date, Time, and DateTime Functions: create function TimeOnly(@DateTime DateTime) returns datetime as begin return dateadd(day, -datediff(day, 0, @datetime), @datetime) end go Or simply cast the DateTime as Time in SQL Server Feb 09, · How to get Time from DateTime format in SQL? Ask Question Asked 7 years, 11 months ago. Cast and substring the Date time column in SQL Server. 1. How to update datetime field and remove date part from the value in SQL? 0. Jun 05, · When SQL Server converts a date stored as a string without a time value to a datetime, it assumes the time to be AM. So even if you do not see a time .