November Happy Hour will be moved to Thursday December 5th.

How can I change the date format of a DateTime object?

Vote:
 

Dear all,

I would like to change the display format of x.PublicationDate which is of type DateTime in following manner:

From: 2/28/2013 12:00:00 AM

To: 28.02.2013

My current code (using MVC 4):  @Html.PropertyFor(x => x.PublicationDate)

Thank you in advance!

Best regards;

Daniel

#66032
Feb 18, 2013 17:41
Vote:
 
#66033
Feb 18, 2013 17:53
Vote:
 

I'm guessing you get that format because of your applications culture setting.

 

But you could change the layout for how you wish to render DateTimes. Joel did a good post on the subject.

#66040
Feb 18, 2013 20:21
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.