Can someone help me figure out how to use the date time stamp and ADD 90 days to the result?

  • Profile Image
    deheacock
    Asked on March 30, 2011 at 11:48 AM

    I have the DATE format working, but would like to calculate DATE plus 90 days.  Thanks in advance.  I tried a couple of the PHP formatting suggestions to no avial.

  • Profile Image
    NeilVicente
    Answered on March 31, 2011 at 12:21 PM

    Hi,

    I apologize but this is not possible within the extent of the Form Builder's functions. You may use external scripts as a workaround, but that would take a firm grasp of scripting languages such as Javascript and the likes.

    Please let us know if you have other concerns. We will be glad to do our best to help you.

     

    Regards,

    Neil

  • Profile Image
    DanielGriffin
    Answered on March 31, 2011 at 12:30 PM

    Hi there,

    I've just done a quick search of the forums and can't find any post associated with your account about a PHP solution.  Can you please let me know what those suggestions were? 

    Also, are you trying to display the date on the form as plus 90 days, or do you just want to record the date plus 90 days?  The only way to display it would be to prepopulate the fields, but the link you use to display the form would need to be generated so that it's "today + 90".  You would need to calculate that before creating the link.  Have a look at this post on prepopulating form fields.

    http://www.jotform.com/help/71-Prepopulating-the-fields-to-your-JotForm-via-URL-parameters

    If you just want to capture it then that is a much problem to solve.  As I say, I'm not sure what has already been suggested, but I would approach it like this.

    1.  Post the data to your own thanks you page:

    2. In your custom thank you page, calculate the date with something like the following PHP code.  (note that the variable names will be different for your form - have a look at the source of the form to find them):

    $day= $_REQUEST['q4_clickTo4[day]'] ;
    $month= $_REQUEST['q4_clickTo4[month]'] ;
    $year= $_REQUEST['q4_clickTo4[year]'] ;

    $plus_ninty_days  = mktime(0, 0, 0,$month , $day+90, $year);

    or

    $plus_ninty_days  = mktime(0, 0, 0,$month+3 , $day, $year);

     

    Hope this helps.  If not then please get back to me.

    Thanks,

    Daniel

     

     

  • Profile Image
    deheacock
    Answered on March 31, 2011 at 01:43 PM

    Thanks Daniel.  The PHP suggestions came from a link in a post from someone at JotForm.  The link took me to the PHP.net page on formating date/time strings.  I can handle a little PHP and a little Javescript, but couldn't make anything work within JotForm.

    I collect data with a form that is emailed to me.  The notification email is pre-formatted with HTML code so that I can cut and paste it directly into a page.  Essentially it is a unordered list with about 10 items.  I currently use a PHP form that  validates the input and sendmails me the formatted data.  JotForm emails were easily adapted to send me the HTML formatted data.

    The data I get is good for 90 days and I want to remember when it has expired.  Currently the PHP form script calculates the current date plus 90days and inserts the result in the email that is sent to me.  I copy this with the rest of the data to a web page.  THIS data is formatted not to display, but I can see it in the code and remove it when the time arrives.

    I could mentally calculate the time by just using the {date} feature, but it am used to scanning the code for expired entries.  As with a lot of requests on this forum, there are workarounds and I guess this is going to be one.  The value add provided by the JotForm service warrantes making a wholesale change for the sites I support, even if I can't totally replecate all of the currently functionality.  JotForm is much faster than manually building forms, especially if I can avoid writing PHP for validating and formatting data.

    Thank you for your detailed and thoughful response.  Probably like you, I spend a fair amount of time in forums like this that support the various tools I use to support my "habit"  I have noticed that this is an exceptionally well supported forum and most of the participants are well intentioned and over-the-top helpful.  I was a little leary of a javascript solution because, unlike a backend PHP page, javascript only works if it is enabled on the client.  But I am going to give it a try.

    BTW, the link on pre-populating fields is new to me.  I had been searching that topic as well this morning and somehow missed it.

    Also, this morning, I discovered the feature that permits someone to edit a submission from a link in in a notification email.  That too will be useful in other forms I am converting.

    Many thanks.

    David

  • Profile Image
    DanielGriffin
    Answered on March 31, 2011 at 04:45 PM

    Thanks for the feedback David,

    Please do let us know if there is anything more that we can do to help.

    Regards,

    Daniel