日期格式化

1.在SQL中实现:

SELECT EmployeeNo,EmployeeName,ProjectCode,ProjectName,CCC,
 CONVERT(VARCHAR(10),InDate,120) InDate,CONVERT(VARCHAR(10),OutDate,120)OutDate
FROM SERP.JPSerp.AMS.AMS_EmployeeProject

 2.页面绑定时:

<asp:Label ID="LabelDate" runat="server" Text='<%# Bind("start_off_date","{0:MM/dd/yyyy}")%>'></asp:Label>

3.服务器端格式化:

string startDate = Convert.ToDateTime(dtExpectTicket.Rows[i]["start_off_date"].ToString()).ToString("MM/dd/yyyy").Replace(@"-", @"/");
posted @ 2010-03-21 20:26  peter cheng  阅读(240)  评论(0编辑  收藏  举报