Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Adding number of days to a date

Hi all,

 

How can we add number of days to a perticular date,

 

For Example,

 

Adding '90' days to the date  '28-11-2016'

giving a result '26-2-2017'

 

Thanking you,

ABHIRATH

3 REPLIES

Re: Adding number of days to a date

to calculate with a date you need it convert in e.g. the data type datetime, than you can add a time to this date (as seconds !!), this works:

str_to_datetime("28.11.2016")+(90*24*3600))

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net


Solution
Solution
Accepted by topic author Abhirath
‎11-28-2016 07:41 AM

Re: Adding number of days to a date

[ Edited ]

Please note that this is only true for the data type datetime. If you are using the data type date, and if you add an integer value, this will add a number of days instead of seconds.

var d : date := str_to_date("2016/11/28")
print d + 90  -- prints 2017/02/26

Re: Adding number of days to a date

Thank you very much Steffen and Michael