This topic is locked

add date + 1 year

5/29/2017 8:57:03 AM
ASPRunnerPro General questions
A
apowazniak author

I have 2 fields in the same table, start_date and end_date, I need date_final to be loaded alone based on start_date + 1 year

A
Arkie 6/12/2017

In AspRunner.Net (haven't yet used Pro), the only way I could make this work in an Access database was to add x number of years to the current date as in :

DateTime.Now.AddYears(x)
This function doesn't appear to work for any other starting date other than .Now, or maybe I just couldn't come up with the correct syntax.
I think the syntax is totally different when using SQL and even then it depends on the what flavor of SQL, i.e. MySQL, Microsoft, or something else.
~Joe

Sergey Kornilov 6/13/2017

There multiple ways to do this, using both SQL Queries and events and it all depends on when this calculation needs to take place. Here are code examples:

https://xlinesoft.com/blog/2014/11/12/datetime-handling-in-web-applications/