General programming question

I have an Byte array with the ascci time and I want to compare it to the current system time
and determine if its < , == , > current time. (for Cobra project) I’m sorta new to C# ???

I think teh easiest way is by converting your string to DateTime object then you can compare the ticks.

Check out [url]Microsoft Learn: Build skills that open doors in your career for the overloads you can use to create a DateTime object. You’ll obviously have to convert the byte array to integers containing the date parts.

Something like


            //example date byte array
            byte[] dateBytes = new byte[]{11,7,19};

            int year  = (int)dateBytes[0] + 2000;
            int month = (int)dateBytes[1];
            int day   = (int)dateBytes[2];
            DateTime date = new DateTime (year, month, day);

You can use operators (<, >, =, etc) to directly compare dates.

Most excellent - TNX : Ray