Quality Center does not store the timestamp in the `BG_DETECTION_DATE` field, only the date.
You can create two new user fields to store the beginning and ending timestamps as Stings.
BG_USER_01 / Label: TS_Opened
BG_USER_02 / Label: TS_Closed
In the `BUG_NEW` subroutine, populate the opened timestamp with this code.
Bug_Fields.Field(''BG_USER_01'').Value=CStr(Now())
In the `BUG_AFTER_POST subroutine`, populate the closed timestamp with this code.
If Bug_Fields.Field(''BG_STATUS'').Value = ''Closed'' Then
If Len(Bug_Fields.Field(''BG_USER_02'').Value) = 0 Then
Bug_Fields.Field(''BG_USER_02'').Value=CStr(Now())
Post
End If
End If
You could also create yet another field to store your defect age, ie `BG_USER_03`.
The defect age in minutes is calculated by: `Cint(DateDiff(''N'',DateOpened, DateFixed))`
The defect age in hours calculated by: `Cint(DateDiff(''H'',DateOpened, DateFixed))`