Datetime field view in View without part of Hours

Asked

Viewed 704 times

5

With the code below I am recovering the Datetime with time past the date, what I would not like.

cursos.Data = DateTime.Parse(collection["Data"]);

I tried to format using substring inside Datetime.Parse, but was unsuccessful.

My domain

[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime Data { get; set; }

In the client’s CMS in editing mode, this being displayed 30/08/2014 00:00:00, although in the bank is with the correct date, ie without the time

  • What do you mean, "with time past the date", try to be clearer in your question, and give more details of your problem.

  • Try using this: courses. Data = Datetime.Parse(Collection["Data"]). Toshortdatestring();

  • I didn’t understand the reason for the negative votes. @Diegozanardo tried but I didn’t succeed.

1 answer

3


Browser other questions tagged

You are not signed in. Login or sign up in order to post.