开发者

Date Time Issue

开发者 https://www.devze.com 2023-03-28 09:40 出处:网络
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

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

精彩评论

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