All pastes #218534 Raw Edit

Macca

public text v1 · immutable
#218534 ·published 2006-10-24 06:55 UTC
rendered paste body
				case 'T':
					{
						int IntDate = BitConverter.ToInt32(Data, Offset);
						int IntTime = BitConverter.ToInt32(Data, Offset + 4);

						if ((IntDate * IntTime) != 0)
						{
							IntDate -= 1721426; // 1721426 == FoxPro's 1/1/0001
							if (IntDate > 0)
							{
								DateTime dt = new DateTime(1, 1, 1, 0, 0, 0);

								dt = dt.AddMilliseconds(IntTime);
								dt = dt.AddDays(IntDate);

								return dt;
							}
							else
							{
								return null;
							}
						}
						else
						{
							return null;
						}
					}