Why is subtracting these two times (in 1927) giving a strange result?
Without more context, it is difficult to say why subtracting two times would give a strange result. Here are a few potential explanations:
The times are not being correctly parsed from their string representations. Make sure you are using the correct format for the times and that you are correctly handling any leading or trailing white space characters.
The times are being stored as strings rather than as some other data type (such as a
Dateobject). If this is the case, subtracting the times will not give a meaningful result. You will need to parse the times and convert them to a numerical data type (such as a
longrepresenting the number of milliseconds since the epoch) before you can subtract them.
The times are being interpreted in different time zones, causing a discrepancy in the result. Make sure that both times are being interpreted in the same time zone.
The times are being treated as point-in-time values, but you are actually trying to find the duration between the two times. In this case, you will need to subtract the earlier time from the later time and then use some other method (such as the
Durationclass) to format the result as a duration.
There is some other error in your code that is causing the strange result. Make sure you are using the correct arithmetic operator (such as
+) and that you are using the correct data types for your calculations.
It is also worth noting that the year 1927 is not relevant to the issue you are experiencing. The year should not affect the result of the subtraction unless you are trying to subtract two dates (as opposed to two times) and the dates are more than 366 days apart (since 1927 was not a leap year).