Let's face it, specs can be get pretty boring sometimes: rarely do they deal with superheros and exotic cars. So, why not do what Julian Melville's predecessor does and spice up boring requirements like "store the number of minutes an event takes" with a little WTF? Sure it may be logical to store a time span as a DateTime or a Number, but look at how fun it is when you store them in "HH:MM" format. And, as an added bonus, this actually works with a small number of rows!
SQL = "SELECT * FROM DailyEntries WHERE TimeSheetID =" & tsid Set dbQTS = Server.CreateObject("ADODB.Recordset") dbQTS.Open SQL, Application("db"), adOpenDynamic, adLockPessimistic hTotatTime = 0 mTotatTime = 0 TotalHours = 0 Do While Not dbQTS.EOF TotalHours = Replace(dbQTS("TotalHours"), ".", ":") hTotatTime = hTotatTime + Replace(Left(TotalHours,2), ":", "") mTotatTime = mTotatTime + Replace(Right(TotalHours,2), ":", "") dbQTS.MoveNext Loop dbQTS.Close Set dbQTS = Nothing hTotatTime = hTotatTime + (Replace(Left((mTotatTime / 60), 2), ".", "")) mTotatTime = mTotatTime - (60 * Replace(Left((mTotatTime / 60), 2), ".", "")) If Len(mTotatTime) = 1 Then mTotatTime = mTotatTime & "0" End If
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!