简体   繁体   中英

How to display date only in vb.net

I need to display date only in vb.net. These are the steps I went through.

  1. added date to sql database. (sql database shows 2013-12-13)
  2. created a table to view it. (shows 12/13/2013 12:00:00 AM)

the methods i've used are:

<%=Formatdatetime(f_purchasedate,2)%>
<%=FormatDateTime(f_purchasedate, "Short Date")%>
<%Response.Write(FormatDateTime(f_purchasedate, 2))%>

Please help. Thanks

EDIT: Was looking at the wrong place. this <%=Formatdatetime(f_purchasedate,2)%> works. Thanks for the help guys

Try This

<%=Formatdatetime(f_purchasedate,2)%>
<%=FormatDateTime(f_purchasedate, "Short Date")%>
<%Response.Write(FormatDateTime(f_purchasedate, DateFormat.ShortDate))%>

OR

 <%Response.Write(f_purchasedate.ToString("yyyy-MM-dd")))%>
f_purchasedate.ToString("d")

请参阅: http : //msdn.microsoft.com/en-us/library/az4se3k1%28v=vs.110%29.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM