Imdad Imdad - 5 months ago 27
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! :)


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").