Adding format to properties

Posted by chris on Stack Overflow See other posts from Stack Overflow or by chris
Published on 2010-04-19T17:53:57Z Indexed on 2010/04/19 18:23 UTC
Read the original article Hit count: 210

Filed under:
|
|

I have an object with a couple of DateTime properties:

public DateTime Start_Date { get; set; }
public DateTime? End_Date { get; set; }

I would like to set a format for each of these, along the lines of

Start_Date.ToString("M/d/yyyy hh:mm tt")

Do I have to code the get, or is there an elegant way to do this?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about formatting