Reputation: 37
public class Coupon{ public datetime startdate{get;set;} }
Below model have yyyy/dd/mm:hh:mm:ss format in entity framework by default but i want chage to dd/mm/yyyy So please help me
there is any attribute for date format
Upvotes: 0
Views: 2343
Reputation: 26
When converting the DateTime instance to a string, format it like so (assuming a DateTime instance called dtObject):
dtObject.ToString("dd/MM/yyyy");
.
Note that the formatting is case sensitive, so "MM" should be upper case while "dd" and "yyyy" should be lower case.
Upvotes: 1