seanly

 

三种方式格式化 日期

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 on 2010-03-22 08:41  seanly  阅读(150)  评论(0编辑  收藏  举报

导航