How do I set the date format to yyyy-mm-dd IN THE datagird templatecolumn column?
Source: Internet
Author: User
1. Date Format Method for binding:
<Asp: boundcolumn datafield = "jointime" dataformatstring = "{0: yyyy-mm-dd}">
<Itemstyle width = "18%" type = "option" text = "option"> </itemstyle>
</ASP: boundcolumn>
2. How to format data items such as DataGrid and datalist:
E. Item. Cell [0]. Text = convert. todatetime (E. Item. Cell [0]. Text). to1_datestring ();
3. Convert the date display format with the string type:
String. Format ("yyyy-mm-dd", yourdatetime );
4. Convert the date display format using the convert method:
Convert. todatetime ("2005-8-23"). tostring
("Yymmdd", system. Globalization. datetimeformatinfo. invariantinfo); // supports traditional Chinese databases.
5. Convert the date display format directly using the tostring method:
Datetime. Now. tostring ("yyyymmddhhmmss ");
Datetime. Now. tostring ("yyyy/mm/dd hh: mm: SS ")
A
6. show only the year and month
Databinder. eval (container. dataitem, "starttime", "{0: yyyy-m }")
7. display all time parts, including: year, month, day, hour, minute, and second
<Asp: boundcolumn datafield = "receipt time" headertext = "receipt time"
Dataformatstring = "{0: yyyy-mm-dd hh24: mm: SS}">
</ASP: boundcolumn>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.