Cancel
Showing results for 
Search instead for 
Did you mean: 

Adding number of days to a date

Pioneer
Pioneer

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

Gears Honored Contributor Gears Honored Contributor
Gears Honored Contributor
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

Re: Adding number of days to a date

Siemens Phenom Siemens Phenom
Siemens Phenom

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
_________________________________________________________________
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Adding number of days to a date

Pioneer
Pioneer

Thank you very much Steffen and Michael