Ask a Question

Keying Future Date

SOLVED
gdave
Regular Contributor

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')

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
A_Roskoshnyi
Community Leader

Re: Keying Future Date

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');

View solution in original post

5 REPLIES 5
A_Roskoshnyi
Community Leader

Re: Keying Future Date

You forgot 'aqDateTime' before Today()

A_Roskoshnyi
Community Leader

Re: Keying Future Date

Full expression with example:

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

gdave
Regular Contributor

Re: Keying Future Date

Thank you for the example.

 

Unfortunately it says invalid expression.

 

gdave_0-1625827730789.png

 

gdave
Regular Contributor

Re: Keying Future Date

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')

A_Roskoshnyi
Community Leader

Re: Keying Future Date

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');

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: