数据表(C#)返回日期/时间(带AM / PM)列,其中包含以下数据
08/01/2011 5:16:02 PM
07/27/2011 9:31:26 PM
如何在C#中将它转换为字符串数据类型?
在SQL中,我可以将datetime转换为字符串,但是如何转换为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