hasokeric
2/12/2017 - 2:24 AM

Epicor still uses seconds since midnight as their Time Indicator and sometimes you need to convert those seconds into human format.

Epicor still uses seconds since midnight as their Time Indicator and sometimes you need to convert those seconds into human format.

// Currently Elapsed Seconds Since Midnight
Convert.ToInt32( ((TimeSpan) DateTime.Now.Subtract( DateTime.Today )).TotalSeconds)

// Convert Epicors Time like NeedByTime or SysTime to Human Readable
DateTime.Today.AddSeconds( MtlQueue.NeedByTime ).ToString("HH:mm:ss"); // ex: 16:22:10
DateTime.Today.AddSeconds( MtlQueue.NeedByTime ).ToString("hh:mm:ss tt"); // ex: 04:22:10 pm

// ABL
// string(MtlQueue.NeedByTime, "HH:MM:SS") // Convert to Human Readable

// Quick LotNum Generation Example to enforce double digits
ttPartTranRow.LotNum = String.Format("{0}-{1}{2}{3}", ttPartTranRow.JobNum, DateTime.Now.Month.ToString("d2"), DateTime.Now.Day.ToString("d2"), DateTime.Now.ToString("yy"));