Quantcast
Channel: All Quality Center / ALM Practitioners Forum posts
Viewing all articles
Browse latest Browse all 14708

Re: ALM 11 Date + time display format

$
0
0

I use below code. Create a user defined field in which you want to capture time (say it is bg_user_12). Create below function

 

------------------------------------------------------------------------------------------

'Function to autopopulate current time in "Time Reported" Field
Function GetServerTime(strTime)
strDate = CDate(strTime)
strHour = DatePart("h", strDate)
strMin = DatePart("n", strDate)
strSec = DatePart("s", strDate)
If len(strHour) < 2 Then
tempStrHour = "0" & strHour
Elseif (strHour-12) > 0 Then
If len(strHour-12) < 2 Then
  tempStrHour = "0" & (strHour-12)
Else
  temStrHour = strHour-12
End If
Else
tempStrHour = strHour
End If
If len(strMin) <2 Then
strMin = "0" & strMin
End If
If len(strSec) < 2 then
strSec = "0" & strSec
End If
If (strHour-12)<0 Then
GetServerTime = tempStrHour & ":" & strMin & ":" & strSec & " AM"
Else
GetServerTime = tempStrHour & ":" & strMin & ":" & strSec & " PM"
End If
End Function

---------------------------------------------------------------------------------------

 

Now under Defects_Bug_New, you can write something like

 

'New Function to autopopulate current time in "Time Reported" Field
  Bug_Fields.Field("BG_USER_12").IsReadOnly = False
  Bug_Fields.Field("BG_USER_12").Value = GetServerTime(TDConnection.Servertime)
  Bug_Fields.Field("BG_USER_12").IsReadOnly = True

 

This will capture current time as well as make the field as read-only so that no user can edit this field intentionally/ un-intentionally.


Viewing all articles
Browse latest Browse all 14708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>