开发者

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 PM

how 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜