Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
view view1.vbhtml
-----

@Html.TextBox("txtToDate", Nothing, New With {.Class = "textinput"})

controller
----------

model.txtFrmDate=DateTime.now();
return view(model)


if i given like this , the textbox shown like this...

4/3/2014 5:45:28 PM


but i need date format only

like this 04-Mar-2014

note: i am using .vbhtml view only

help me

thanks in advance

Velsamy A
Posted
Updated 3-Apr-14 2:24am
v2

i used this code Guru, its working thank you

C#
@Html.TextBox("txtFrmDate", DateTime.Now.ToString("dd-MMM-yyyy"), New With {.Class = "textinput"})
 
Share this answer
 
You may want to use something like this

C#
model.txtFrmDate=System.DateTime.Today.ToShortDateString()
 
Share this answer
 
Comments
avelsamy 7-Apr-14 4:52am    
i used this., its working but, the date passing like this #04/04/2014#,
unwanted # sympol is there
Guruprasad.K.Basavaraju 7-Apr-14 17:10pm    
That's surprising.. What is the datatype of txtFrmDate ?

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