0

I am using delimiters to get the values directly from the model in a data-bound fashion.

I wish to force this format to "yyyy/MM/dd HH:mm:ss" on specific values/entries/fields.

There are 2 different lines of code in particular, one being editable and the other not.

Here are the 2 lines:

<%: Html.Encode(Model.DateTimeValue)%>
<%: Html.TextBoxFor(m => m.DateTimeValue, new { @class = "datetimepicker" })%>

How can I force these to comply with the above mentioned format?

I would prefer it if there was an inline solution to this.

EternalWulf
  • 742
  • 9
  • 21
  • See this [post](http://stackoverflow.com/questions/1389187/set-default-datetime-format-c-sharp) – scheien Jul 02 '14 at 08:15
  • duplicate...http://stackoverflow.com/questions/1389187/set-default-datetime-format-c-sharp –  Jul 02 '14 at 08:30
  • The post mentioned sets a global culture. I am looking for an inline solution, so as to have 2 or 3 different formats on a single page if need be. – EternalWulf Jul 02 '14 at 08:35
  • An editor template might work for you – 3dd Jul 02 '14 at 11:44
  • @3dd How would I apply it to the above mentioned code? the normal .ToString("format") does not seem to work. – EternalWulf Jul 02 '14 at 12:36
  • for date formatting I used http://www.datejs.com/ using one line of javascript I format the data to the screen. I can post an example if you like tommorow when I'm back at work – 3dd Jul 02 '14 at 15:51
  • As long as it is an inline code that I can use on the above mentioned lines, it would be greatly appreciated. – EternalWulf Jul 02 '14 at 16:26

0 Answers0