Date Time Issue
the data table (C#) returns date/time (with AM/PM) column with below data,
08/01/2011 5:16:02 PM
07/27/2011 9:31:26 PMhow to convert the same to string data type in C#?
in SQL, i can convert datetime to string by below, but how to convert in C#....?
ISNULL(CASE WHEN CONVERT(CHAR(10),FirstCommunicationDate,108)<'12:00:00' THEN CONVERT(VARCHAR(11),FirstCommunicationDate,101)+ SUBSTRING(CONVERT(VARCHAR(20),FirstCommunicationDate,109),12,15) + ' AM'
开发者_如何学运维ELSE CONVERT(VARCHAR(11),FirstCommunicationDate,101)+ SUBSTRING(CONVERT(VARCHAR(20),FirstCommunicationDate,109),12,15) + ' PM' END, '') AS FirstCommunicationDate
You can use DateTime.ToString() Method for this Purpose.
精彩评论