Add a date field using a different year

Add a date field using a different year

Hello,

This probably seems obvious, but I'm trying to add a date using a year from a different date. I was trying to use newdate, but I don't think I have the syntax right for deluge. Sorry very newbie here. I imagine I have to use todate, but could anyone help with the syntax?

  1. invoice_record = zoho.crm.getRecordById("Invoices", invoice_id);
    start_date = invoice_record.get("Service Start Date");
    end_date = invoice_record.get("Service End Date");
    invoice_date = invoice_record.get("Invoice Date");
    start_date_month = start_date.getMonth();
    start_date_year = start_date.getyear ();
    end_date_year = end_date.getyear();

    // calculate how many months in the service period

    service_length = start_date.monthsBetween(end_date);

    //April Revenue Recognition

    april_date_start_year = newdate( Year(start_date_year),Month(04),Day(30) );

    april_date_end_year =  newdate ( Year(end_date_year),Month(04),Day(30) );

    if (april_date_start_year >= start_date || april_date_end_year < = april_date_end_year )
    { rev_rec_april = "Sub Total" / service_length }
    else
    {rev_rec_april = 0}

    invoice_record.put("April Revenue", rev_rec_april);

    update_resp = zoho.crm.updateRecord("invoices", invoice_id.toString(), invoice_record);