Forum Discussion

gdave's avatar
gdave
Regular Contributor
3 years ago
Solved

Keying Future Date

Hi all

 

In the date field, I would like to enter a future date which is 1yr in future from today's date.

 

I am using a code expression (in delphi) and somehow not able to get it right. The below code is not working for me so any help is much appreciated.

 

DateTimetoFormatStr(aqDateTime.AddMonths(Today(), 24 '%d/%m/%Y')

 

 

 

 

  • Perhaps for delfi there is a problem in quotation marks (although both work for me in JScript). Try single quotes with my expression:

    aqConvert.DateTimeToFormatStr(aqDateTime.AddMonths(aqDateTime.Today(), 24), '%d/%m/%Y');

5 Replies

  • Full expression with example:

    var future_date = aqConvert.DateTimeToFormatStr(aqDateTime.AddMonths(aqDateTime.Today(), 24), "%d/%m/%Y");

    • gdave's avatar
      gdave
      Regular Contributor

      Thank you for the example.

       

      Unfortunately it says invalid expression.

       

       

      • gdave's avatar
        gdave
        Regular Contributor

        This got expected as a valid expression but still not giving me the desired result of setting the date of 2yrs from current date.

         

        aqConvert.DateTimeToFormatStr(aqDateTime.AddMonths(aqDateTime.Today), 24, '%d/%m/%Y')