Hello everyone, So im parsing TLE data, for instance i got a line: "88109B", "88" means that the satellite was de-orbited at 1988. How can i write a short program that would change the first two characters to given date. Also if the string is something like this:"05108B", it means that the satellite was de-orbited at 2005, not 1905. Can anyone help me? Thanks alot !
Code (csharp): public static int ParseYearTLE(string data) { int inCentury; if (int.TryParse(data.Substring(0, 2), out inCentury)) { if (inCentury < 0) return -1; int century = inCentury <= 19 ? 20 : 19; // Up to 19 assume the 20th century, else the 19th century int year = 100 * century + inCentury; return year; } return -1; } This would return the year as int. You could change that to a DateTime, but that seems more specific than the data contains. If there is a parsing error, it will return -1.