Programing QA

Programing/Developing Questions & Answers. Focus on business application material

Convert DateTime to Priority ERP format and the other way around..

 

Code Snippet
  1. // Convert DateTime to Priority ERP Format
  2.  
  3. DateTime now = DateTime.Now; // get regular now.
  4. DateTime startOfUniverse = new DateTime(1988, 1, 1); // according to Eshbal.
  5. TimeSpan s = now - startOfUniverse; // make the diffrence.
  6. double timeInPriorityFormat = s.TotalMinutes; // And here you go. time on priority erp format.
  7.  
  8. // Convert Priority ERP time format to DateTime
  9.  
  10. int priorityERPTime = 30222332 // some int number represent the priority erp format.
  11. DateTime startOfUniverse2 = new DateTime(1988, 1, 1); // get when it all started.
  12. startOfUniverse = startOfUniverse.AddMinutes(priorityERPTime); // and here we go.