How do a make a conditional date based on a business date

  • gregseares
    Asked on January 9, 2016 at 7:02 PM

    I'm building a form that capture some information from bartenders at my restaurant, and sometimes they will submit it after midnight, at the end of their shift. So I'd like to calculate the "business date" regardless of whether it's before or after midnight. For instance, if they submit the form at 11pm on 1/9/16, then the business date will be 1/9/16. But if they submit it after midnight - say, at 1am on 1/10/16, it will still set the business date as 1/9/16. I tried to set this up with conidtional logic but I couldn't figure it out. I think I need to have a date field and a time field (the latter set to 24 hour format), and then my output field will be called "business date", which will be the current date if it's before midnight and the current date minus 1 if it's after midnight. And then I realize there needs to be a cutoff time so that people who submit on the next business day, say at noon on 1/10/16, don't have the logic change the date to the previous day. I think a good cutoff time would be 6am. So I think the logic will be something like, "if (current time) is between midnight and 6am THEN business date = (current date)-1" - I just can't figure out the right way to do this via the jotform logic

    Jotform Thread 740712 Screenshot
  • Kevin Support Team Lead
    Replied on January 10, 2016 at 12:23 PM

    Hi,

    Thank you for contacting us.

    Yes, you can make that condition  in your form, I cloned it and I can see you are capturing the current day, the current time and then as I understand, you need to subtract the current day with -1 after passed some hour.

    I tried to do it, as you explained and I can see it's working.

    First set the current date : 

    How do a make a conditional date based on a business date Image 1 Screenshot 30

    Then add an Update/Calculate field conditions as the one in the image below : 

    How do a make a conditional date based on a business date Image 2 Screenshot 41

    You can add a Before statement as there is not a between option, I set the time to 11:00 , however as you are using 24 hours format, after the midnight will be 23:00.

    Take a look to my cloned form here : https://form.jotform.com/60094571095962 

    Do let us know if it's what you were looking for.

    Thanks.

  • gregseares
    Replied on January 10, 2016 at 3:38 PM

    Perfect! Thanks so much Kevin. Got it, case closed. Cheers!

  • Chriistian Jotform Support
    Replied on January 10, 2016 at 10:56 PM

    On behalf of my colleague, you are most welcome. Feel free to contact us again if you have any other concerns. Regards.