5 Replies Latest reply on Jan 5, 2015 4:05 PM by gkaiseril

    How to calculate a date in the future and set it as field value?

    avelkovdf

      I'm trying to set the value of a read-only field to a date and time 72 hours from the current date and time. Here's how I'm doing it now:

       

      var futureInMilliseconds = new Date().getTime() + 259200000; // current date and time + 72 hours in milliseconds

       

      field.value = new Date(futureInMilliseconds);

       

      The field is formatted as "m/d/yyyy h:MM tt". When I test this in the debugger I see it listing the correct date and time in the future, but the value applied to the field is always the current date and time. So, I'm having a difficult time getting this to work for something that should be fairly straight forward and simple. I'd appreciate any suggestions.