I am developing on asp.net mvc, i have an issue with date time storing in sql db.
Following is my model for date field.
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
public DateTime ReleaseDate { get; set; }
Following is my view for date picker
<div class="editor-field">
@Html.TextBoxFor(model => model.ReleaseDate, new { @class = "dpiker" })
@Html.ValidationMessageFor(model => model.ReleaseDate)
</div>
<script type="text/javascript">
$(document).ready(function () {
$('.dpiker').datepicker({ dateFormat: "dd/mm/yy" });
var date = "09/12/2013";
var parts = date.split('/');
var date = new Date(parseInt(parts[2], 10), // year
parseInt(parts[1], 10) - 1, // month, starts with 0
parseInt(parts[0], 10)); // day
});
</script>
This is what i do to enter date:
And this is what the output comes
So I cant figure out where do i need to parse or convert the data of the text box.
My form is serialized.