public static int ConvertDateTimeToInt(System.DateTime time)
{
System.DateTime startTime = System.TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
string timeHours = (time - startTime).Hours.ToString().PadLeft(2, ‘0‘);
string timeMinutes = (time - startTime).Minutes.ToString().PadLeft(2, ‘0‘);
string timeSeconds = (time - startTime).Seconds.ToString().PadLeft(2, ‘0‘);
string timeStamp = (time - startTime).Milliseconds.ToString().PadLeft(2, ‘0‘);
int timeInt = Convert.ToInt32(timeHours.ToString() + timeMinutes.ToString() + timeSeconds.ToString() + timeStamp.ToString());
return timeInt;
}