I have an sql DateTime (ms sql server) and want to extract the same date without the seconds: e.g. 2011-11-22 12:14:58.000 to become: 2011-11
DateTime
2011-11-22 12:14:58.000
2011-11
From SQL Server 2014, You can use Format function for this.
for Ex.
declare @Startdate datetime = '2020-11-07 15:27:50.713' set @Startdate = Convert(datetime,FORMAT(@Startdate, 'yyyy-MM-dd HH:mm')) > Result is 2020-11-07 15:27:00.000