Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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: 13975
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: Thu Mar 28 10:48:54 CET 2024

Total time taken to generate the page: 0.00794 seconds