Question : How to format output of sql statement

Hi,

I have the following sql code in C# 2005 -

            System.Data.SqlClient.SqlDataAdapter da2 = new System.Data.SqlClient.SqlDataAdapter("SELECT   m.fat, m.chest, m.waist, m.neck, m.hips, m.wristL, m.wristR, m.forearmL, m.forearmR, m.bicepL, m.bicepR, m.calveL, m.calveR, m.thighL, m.thighR,  m.UserID, m.Weight, m.DateTaken, ISNULL(m.Weight - p.Weight, 0) AS 'Gain / Loss' FROM Measurements AS m LEFT OUTER JOIN Measurements AS p ON p.UserID = m.UserID AND p.DateTaken = (SELECT MAX(DateTaken) AS Expr1 FROM Measurements AS mm WHERE (DateTaken < m.DateTaken)) WHERE (m.UserID = '" + globalclass.userID.ToString() + "') ORDER BY m.DateTaken asc", con2.ConnectionString);

I am trying to find out how I format m.DateTaken to show lets say todays date 17/02/08 from what is currently returned 17/02/08 2013

Many Thanks
Lee

Answer : How to format output of sql statement

Try:

CONVERT(varchar, m.DateTaken, 3)
Random Solutions  
 
programming4us programming4us