Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I have this this
@Html.TextBoxFor(model => model.RecievedDate, null, new { @class= "datepicker"})

@Html.ValidationMessageFor(model => model.RecievedDate)
C#


and the jquery gives a default date format of 31/03/2014 and my database recives this kind of format "2014-03-31" how can i format it so that i can store it in the database?
Posted

1 solution

use ToString method and pass the format string to get your required format type.
for example:
original_date = "2014/12/31"
changed_date = original_date.ToString("yyyy-mm-dd") //this will give you "2014-12-31"
 
Share this answer
 
v2

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