Imdad Imdad - 1 year ago 111
C# Question

Change DateTime format of property in object?

I'm trying to change the date time format of "TimeStamp" which is a property in the object called "x"(for example).

public DateTime Timestamp { get; set; }

That is the property inside the object class.

How would I change it so it returns and sets the timestamp date time to the format of : dd/MM/yyyy HH:mm

Thank you! :)

Answer Source

DateTime is an object type, while the format is just a representaion. You could wrap it with a method, which performs a DateTime.parse() and Timestamp.toString("dd/MM/yyyy HH:mm").

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download