Convert Date + Time to Number

  • Time
int result = int.Parse(DateTime.Now.ToString("HHmmssfff"));
//040436168
  • Date + Time
long result = Int64.Parse(DateTime.Now.ToString("yyyyMMddHHmmssfff"));
//20240322040436168

Discover more from naiwaen@DebuggingSoft

Subscribe to get the latest posts sent to your email.