HTML Templates - Date Calculation

Hi all,

I'm working on a new HTML template for our Group Sales program and one of the fields that I'd like to include is a "Deposit Due" field that is essentially Order Date + Two Weeks (ideally displayed in MM/DD/YYYY format). My HTML skills are pretty rusty, so I'm not sure how to best achieve this calculation in my template. Any advice? 

Thanks!

Lauren

Parents
  • Hi Lauren,

    Something like this might work.  Add two variables at the top of the template:

    var orderDateTime = DateTime.Parse(Model.OrderProductView.OrderDateTime.ToString());
    var depositDue = orderDateTime.AddDays(14);
    And then position the date in the main block:
    <b>Deposit Due:</b> @depositDue.ToString("MM/dd/yyyy")<br />
    Hope that works.
    Annie
Reply
  • Hi Lauren,

    Something like this might work.  Add two variables at the top of the template:

    var orderDateTime = DateTime.Parse(Model.OrderProductView.OrderDateTime.ToString());
    var depositDue = orderDateTime.AddDays(14);
    And then position the date in the main block:
    <b>Deposit Due:</b> @depositDue.ToString("MM/dd/yyyy")<br />
    Hope that works.
    Annie
Children