Tayyab
Tayyab

Reputation: 349

how to separate date and time from same column sql

I have a column named DateTime but i want to show only Date from column not the time here is my query to show Date and Time from table

select Feedback.DateTime from ctrData2.Feedback

So help me to separate from Date from DateTime column.

Upvotes: 0

Views: 236

Answers (2)

switch
switch

Reputation: 116

try this -

select date(Feedback.DateTime) from ctrData2.Feedback;

Upvotes: 2

belaassal
belaassal

Reputation: 133

You can try

select YEAR(Feedback.DateTime)+"-"+MONTH(Feedback.DateTime)+"-"+DAYOFMONTH(Feedback.DateTime) 
from ctrData2.Feedback

OR

select date_format(Feedback.DateTime, '%Y %m %d') from ctrData2.Feedback

Upvotes: 0

Related Questions