U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ Core » Code for Substrating Months And Years function In Date Class
Code for Substrating Months And Years function In Date Class [message #41998] Mon, 10 February 2014 11:30 Go to next message
dave is currently offline  dave
Messages: 14
Registered: July 2011
Promising Member
hi,
i was going through the functions in Date class and noticed that
there was no function type for substrating months or years from a given date.
can anybody give me the codes for substrating months or years from a given date?

for example like--
Date SubMonths(Date d, int months)
{
....
....
};

Date SubYears(Date d, int years)
{
.....
.....
};

thanks and regards,

dave
Re: Code for Substrating Months And Years function In Date Class [message #42000 is a reply to message #41998] Mon, 10 February 2014 13:30 Go to previous message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
There is AddMonths, which allows negative month count.

Years are simple (no adjustment because of varying month len involved), just do d.year -= n;

Mirek
Previous Topic: Callback (THISBACK) Improve
Next Topic: proposal: bool Index::HasUnlinked()
Goto Forum:
  


Current Time: Tue Apr 28 08:28:02 GMT+2 2026

Total time taken to generate the page: 0.02048 seconds