public static void Main()
for (int d = 1; d< 25; d++)
Console.WriteLine(g.ToString());
System.Threading.Thread.Sleep(1);
System.Threading.Thread.Sleep(2);
public static Guid ToSeqGuid()
long ticks = System.DateTime.UtcNow.Ticks;
byte[] ticksBytes = BitConverter.GetBytes(ticks);
Array.Reverse(ticksBytes);
Guid myGuid = new Guid();
byte[] guidBytes = myGuid.ToByteArray();
Array.Copy(ticksBytes, 0, guidBytes, 10, 6);
Array.Copy(ticksBytes, 6, guidBytes, 8, 2);
Guid newGuid = new Guid(guidBytes);
string strG = newGuid.ToString();
strG = strG.Replace("00000000",DateTime.Now.ToString("yyyyMMdd").ToString() );
newGuid = Guid.Parse(strG);
private Guid GenerateComb()
byte[] guidArray = Guid.NewGuid().ToByteArray();
DateTime baseDate = new DateTime(1900, 1, 1);
DateTime now = DateTime.Now;
TimeSpan days = new TimeSpan(now.Ticks - baseDate.Ticks);
TimeSpan msecs = now.TimeOfDay;
byte[] daysArray = BitConverter.GetBytes(days.Days);
byte[] msecsArray = BitConverter.GetBytes((long) (msecs.TotalMilliseconds / 3.333333));
Array.Reverse(daysArray);
Array.Reverse(msecsArray);
Array.Copy(daysArray, daysArray.Length - 2, guidArray, guidArray.Length - 6, 2);
Array.Copy(msecsArray, msecsArray.Length - 4, guidArray, guidArray.Length - 4, 4);
return new Guid(guidArray);