Advance Date function

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ab042
Posts: 326
Joined: Mon Jul 17, 2006 4:11 am

Advance Date function

Post by ab042 »

I'm looking for a way to advance the current date and keep the day of week, or advance the month and keep the same day or Advance the year and keep the same month and day.

For example: 08/14/06 Advance ONE WEEK would be on a Monday 08/21/06 or 08/18/06 Advance ONE MONTH would be 09/18/06 or Advance ONE YEAR would be 09/18/07.

I found where I can advance the DAYS and I guess advance 7 days for a week would work, but not for MONTH or YEAR?

Any suggestions?
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

To advance one week:
MyObject.MyDate + 7

To advance one year:
DATE(DAY_OF_MONTH(MyObject.MyDate), MONTH(MyObject.MyDate), YEAR(MyObject.MyDate) + 1)

You can also use function DATE for advancing months by incrementing the month parameter. Functions like LAST_DAY_OF_MONTH, LAST_DAY_OF_NEXT_MONTH, and others may be useful if you need to take special care when advancing end-of-month dates, like the 31st.
Aware IM Support Team
ab042
Posts: 326
Joined: Mon Jul 17, 2006 4:11 am

Post by ab042 »

Sometimes you can't see the forest for the trees, I feel stupid.
Thanks
Post Reply