In my model I'm storing the timestamp in milliseconds, like this:
public Nullable<long> timestamp { get; set; }
I want the users to add the date in text format (later I'll probably add a datetimepicker) and convert it to milliseconds.
This is what I have in my view
<div class="form-group">
@Html.LabelFor(model => model.timestamp, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.timestamp, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.timestamp, "", new { @class = "text-danger" })
</div>
</div>
This shows an edittext with an arrow for changing the integer values (1, 2, 3...) as my field type is long.
How can I allow the users to introduce a string instead of long, like "2015/11/11 18:14" and convert it to milliseconds automatically for storing in my timestamp long field?