wyUpdate.Common.ReadFiles.ReadDateTime C# (CSharp) Method

ReadDateTime() public static method

public static ReadDateTime ( Stream fs ) : System.DateTime
fs Stream
return System.DateTime
        public static DateTime ReadDateTime(Stream fs)
        {
            //skip the "length of data" int value
            fs.Position += 4;

            byte[] tempBytes = new byte[4];

            //Year
            ReadWholeArray(fs, tempBytes);
            int year = BitConverter.ToInt32(tempBytes, 0);

            //Month
            ReadWholeArray(fs, tempBytes);
            int month = BitConverter.ToInt32(tempBytes, 0);

            //Day
            ReadWholeArray(fs, tempBytes);
            int day = BitConverter.ToInt32(tempBytes, 0);

            //Hour
            ReadWholeArray(fs, tempBytes);
            int hour = BitConverter.ToInt32(tempBytes, 0);

            //Minute
            ReadWholeArray(fs, tempBytes);
            int minute = BitConverter.ToInt32(tempBytes, 0);

            //Second
            ReadWholeArray(fs, tempBytes);
            int second = BitConverter.ToInt32(tempBytes, 0);

            return new DateTime(year, month, day, hour, minute, second);
        }