Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
how to get date as "YYYY-MM-DD" without time in dropdownlist in asp.net
Posted
Updated 7-Sep-11 6:00am
v3

Have you tried this?

date.Format("yyyy-MM-dd")
 
Share this answer
 
Add items in DropDownlist like this
this.MyDateTime.ToString("yyyy-MM-dd")
 
Share this answer
 
Hi Ravi,

DateTime dt = DateTime.Today;
       string dd = dt.Day.ToString();
       string mm = dt.Month.ToString();
       string yy = dt.Year.ToString();

       string date = yy + "/" + mm + "/" + dd;
       DropDownList1.Items.Add(date);

If you have any problem,send me a query.
Have a good time!!!
 
Share this answer
 
dtp.CustomFormat = "yyyy/mm/dd";
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900