cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Auto-Populate Date Field with a Particular Date of a Day in a Week

Jump to solution

I have a form that has a field, "Next Meeting Date".  This field needs to auto-populate the date of the next "Tuesday".  So, if the form is opened today (Monday), September 26, 2016, the field should auto-populate 9/27/2016.  If the form is opened on Wednesday, 9/28/2016, it then should auto-populate the date 10/4/2016 (the next Tuesday).

Is this possible?

Thank you in advance!

Labels: (2)
Tags (1)
Reply
4 Replies
Highlighted
Automation Master
Automation Master

Re: Auto-Populate Date Field with a Particular Date of a Day in a Week

Jump to solution

Michael Huynh‌, I believe you answered this yourself from your other post doing 

function xnextSession() {
  var ret = new Date();
  ret.setDate(ret.getDate() + (2 - 1 - ret.getDay() + 7) % 7 + 1);
  return ret;
}

 

NWF$(document).ready(function(){
  NWF$('#'+NextMeetingDateID).val(xnextSession);
});

Did that work for you well?

Reply
Not applicable

Re: Auto-Populate Date Field with a Particular Date of a Day in a Week

Jump to solution

Yes Andrew.  Sorry I forgot to mark it.  BUT, I was stuck on getting the date to format properly to which you responded and provided the extra code that it needed.  Thank you again for your assistance.

Reply
tctctc
Nintex Newbie

Re: Auto-Populate Date Field with a Particular Date of a Day in a Week

Jump to solution

Hi Michael, may I know how you formatted the date? Because I tried the code above and it gave me a very long date format, I only need the MM/dd/yyyy format. Can you help me on this?

0 Kudos
Reply
debosmita03
Nintex Newbie

Re: Auto-Populate Date Field with a Particular Date of a Day in a Week

Jump to solution

Not sure if you have already got the answer for this, I have used the below formula successfully in

formatDate(your_date_field,'MM/dd/yyyy')

0 Kudos
Reply