Section1
We need to compute some valid EcDateTime operations: adding, subtracting, and reseting "bad" final values to valid ones (e.g. if you add five days to Dec. 31st, you have to recognize that days need to be reset from 36 and that the month and year will change, etc.).
currentEcDateTime.Now(): 2012/05/20 22:44:28
Test the SetEcDateTime Functions
-
The Battle of Hastings occurred on SetEcDateTime(1066, 10, 14, 9, 0, 0): 1066/10/14 09:00:00
-
Bad Year; SetEcDateTime(0, 12, 11, 0, 0, 0): 0
-
Bad Month; SetEcDateTime(-957, 13, 11, 0, 0, 0): 0
-
Bad Day; SetEcDateTime(-957, 12, -2987, 0, 0, 0): 0
-
Bad Hour; SetEcDateTime(-957, 12, 11, -2, 0, 0): 0
-
Bad Minute; SetEcDateTime(-957, 12, 11, 0, 60, 0): 0
-
Bad Second; SetEcDateTime(-957, 12, 11, 0, 0, 3789): 0
-
The Invasion of Poland occurred on SetEcDateTime("1939/09/01 04:45:00"): 1939/09/01 04:45:00
-
Poorly Formatted String; SetEcDateTime("-876/000010/29 6:58:4"): -876/10/29 06:58:04
-
Bad Minute; SetEcDateTime("876/11/29 6:-58:41"): 0
-
Invalid Parsing Input; SetEcDateTime("thisIsNotAnInteger/10/29 6:58:41"): 0
-
Non-Standard Input Format; SetEcDateTime("876/19 /29 6:5 8:41"): 0
-
Completely Incorrect Data; SetEcDateTime("The quick brown fox jumped over the lazy dog."): 0
Test the Add Functions
-
currentEcDateTime.AddTime(currentEcDateTime, -300, 50, 50, -2, -2,-2): 0
Note: The AddTime() function won't work if the EcDateTime from "quick brown fox" above is an error code.
-
currentEcDateTime.AddSeconds(1000000): 0
Still nothing. We have to fix the EcDateTime and make it valid first.
-
Fixing w/ SetEcDateTime("296/10/29 06:58:41"): 296/10/29 06:58:41
-
currentEcDateTime.AddTime(-300, 50, 50, -2, -2, -2): 1/02/17 04:56:39
Now this works.
-
currentEcDateTime.AddYears(-3): -3/02/17 04:56:39
Going below 1AD.
-
currentEcDateTime.AddYears(5): 3/02/17 04:56:39
Rising above 1BC.
-
currentEcDateTime.Now(): 2012/05/20 22:44:28
Now let's have some fun...
-
currentEcDateTime.AddSeconds(1000000): 2012/06/01 12:31:08
1,000,000 seconds ~ 16,667 minutes ~ 278 hours ~ 11.6 days = 11 days 13h 46m 40s
-
currentEcDateTime.AddMinutes(-1000): 2012/05/31 19:51:08
-1,000 minutes = -16h -40m
-
currentEcDateTime.AddHours(1000): 2012/07/11 11:51:08
1,000 hours = 41 days 16h
-
currentEcDateTime.AddDays(63): 2012/09/12 11:51:08
1,000 hours = 2 months 1 day
-
currentEcDateTime.AddMonths(-128): 2002/01/12 11:51:08
-128 months = -10 years -8 months
-
currentEcDateTime.AddYears(-2002): -1/01/12 11:51:08