Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
How to convert date format(dd/MM/yyyy) in MVC3 in textbox
My code is as follows

@Html.EditorFor(model => Model.created_date) 

Thanks,
Sampath bejugama .
Posted
Updated 29-Feb-12 2:24am

 
Share this answer
 
Comments
sampath1750 29-Feb-12 8:32am    
I want to display date in textbox, ur code is not working
[no name] 29-Feb-12 9:44am    
Explain what is not working. Your comment is very uninformative.
sampath1750 29-Feb-12 23:50pm    
if i write

@Html.EditorFor(model => Model.created_date..ToShortDateString()) i got below error

Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.
Hi,

Have you tried this:
HTML
@Html.TextBoxFor(mode => model.created_date.ToString("dd/MM/yyyy")
 
Share this answer
 
Comments
sampath1750 29-Feb-12 23:59pm    
I tried but not working

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