How to format deliverydate and deliverytime in order related emails or sms
To format deliverydate or deliverytime in order related emails or sms.
In your email or sms template use @Model.DeliveryDate attribute and use it like:
- To just get the time part from the deliverydate: @Model.DeliveryDate.Value.ToShortTimeString()
- To just get the date part from the deliverydate: @Model.DeliveryDate.Value.ToShortDateString()
So if you want nice format of date and time about delivery in the email or sms you can write:
We deliver your order @Model.DeliveryDate.Value.ToShortDateString() at @Model.DeliveryDate.Value.ToShortTimeString()
Result:
We deliver your order 2015-06-14 at 15:39