I want to select value from "date" type column. I have there value like 29.04.2019 but when I select it and print in view I get 29.04.2019 00:00:00.

My query: SELECT Id, project_name, start_date, end_date, Team_Id FROM Projects;

3 Answers

Udhay Titus On Best Solutions

If you want DD.MM.YYYY format use CONVERT(varchar(10), Getdate(), 104)

SELECT Id, project_name, CONVERT(varchar(10), start_date, 104) as start_date,
CONVERT(varchar(10), end_date, 104) as end_date, Team_Id FROM Projects;

all sql format check the link here

Community On

use Convert function to convert datetime to date

SELECT Id, project_name, convert(date,start_date) start_date, convert(date, end_date)end_date, Team_Id FROM Projects;
Ravi Sharma On
SELECT Id, project_name, 
convert(date,start_date) as start_date, 
convert(date,end_date) as end_date, 
Team_Id FROM Projects