I need to set up billing cycles and process payments. So for example I will process a payment immediately and then set the next one up to process exactly one month from then.
So if I get DateTime.Now is there any quick way to just add a month to it? how about a year? Or will I need to parse it out into MM, YYYY, DD, and then add to MM, if MM == 12 increment year, etc... then piece it back together for my string to submit to this paypal plugin?
Here is the final format needed:
"YYYY-MM-DDTHH:MM:SS.MSZ".
This is explained in more detail below:
YYYY Four-digit year, e.g. "2005"
MM Two-digit month.
DD Two-digit day.
T Indicates time follows the date.
HH Hours in military time (24-hour format).
MM Minutes
SS Seconds
MS Milliseconds
Z 1-character (US military) representation of the time zone, "A" - "M" are negative offsets -1 to -12, with "J" not being used. "N" - "Y" are positive offsets 1 to 12, and "Z" indicates GMT/UTC (no offset).
For instance, "2004-05-26T15:00:00.00Z" is May 26th, 2004 at 3:00pm GMT.
So basically I am wondering if there are any easy built in ways to add one month or one year to a date without parsing the crap out of it as a string.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…