using System.Collections.Generic;
public static void Main()
string FormatDateTime = "yyyy-MM-dd HH:mm:ss.fff";
List<string> newList = new List<string>();
newList.Add("2021-07-12 07:23:32.770");
newList.Add("2021-07-12 07:22:30.060");
newList.Add("2021-07-12 07:25:32.790");
newList.Add("2021-07-12 07:23:30.040");
newList.Add("2021-07-12 07:24:32.810");
newList.Add("2021-07-12 07:21:30.080");
newList.Add("2021-07-12 07:25:32.820");
newList.Add("2021-07-12 07:23:30.010");
newList.Add("2021-07-12 07:24:32.840");
newList.Add("2021-07-12 07:21:29.990");
newList.Add("2021-07-12 07:24:32.750");
newList.Add("2021-07-12 07:23:29.980");
newList.Add("2021-07-12 07:24:32.870");
List<long> listFormatDate = new List<long>();
List<long> result = new List<long>();
List<long> listResult = new List<long>();
for (int i = 0 ; i < newList.Count; i++)
DateTime myDate = DateTime.ParseExact(newList[i], FormatDateTime, System.Globalization.CultureInfo.InvariantCulture);
listFormatDate.Add(myDate.Ticks / 10000);
for (int i = 0; i < listFormatDate.Count; i++)
result.Add(listFormatDate[i]);
while (number < listFormatDate.Count)
for (int i = 0; i < listFormatDate.Count; i++)
result.Add(listFormatDate[i]);
result.RemoveAt(result.Count - 1);
for (int i = 0; i < result.Count; i++)
double x = tong / result.Count;
listResult.Add((long)Math.Round(x, 0, MidpointRounding.AwayFromZero));
for (int i = 0; i < listResult.Count; i++)
DateTime myDate = new DateTime(listResult[i]*10000);
String kq = myDate.ToString(FormatDateTime);