home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / nivb_src / global.bas < prev    next >
BASIC Source File  |  1993-06-02  |  1KB  |  42 lines

  1. '-----Global declarations specific to NWTEST-----
  2. Global originalPrefConnID%
  3. Global Const MAX_CONNS = 10
  4. Global serverName$
  5. Global volumeName$
  6. Global dirPath$
  7. Global currentForm As Integer
  8. Global Const AFP_FORM = 1
  9. Global Const FILE_FORM = 2
  10. Global PrintServerName$
  11.  
  12. Function GetDate$ (dateVal%, timeVal%)
  13. ' converts a DOS format date and/or time to a string
  14. 'if timeVal = 0, returns just the date, and vice versa
  15.  
  16.     If (dateVal% <> 0) Then
  17.         theYear% = ((dateVal% And &HFE00) / &H200) + 80
  18.         theMonth% = (dateVal% And &H1E0) / &H20
  19.         theDay% = dateVal% And &H1F
  20.  
  21.         theDate$ = Format$(theMonth%, "00") + "/" + Format$(theDay%, "00") + "/" + Format$(theYear%, "00")
  22.     End If
  23.  
  24.     If (timeVal% <> 0) Then
  25.         'save the sign bit, since VB doesn't have unsigned types
  26.         'should do the same with the year, but it won't matter until 2044
  27.         signBit% = timeVal% And &H8000
  28.         theHour% = (timeVal% And &H7800) / &H800
  29.         'add the sign bit back in, if it was there
  30.         If (signBit% <> 0) Then theHour% = theHour% + &H10
  31.         theMin% = (timeVal% And &H7E0) / &H20
  32.         theSec% = timeVal% And &H1F
  33.  
  34.         theTime$ = Format$(theHour%, "00") + ":" + Format$(theMin%, "00") + ":" + Format$(theSec%, "00")
  35.     End If
  36.  
  37.     If ((dateVal% <> 0) And (timeVal% <> 0)) Then sep$ = " "
  38.  
  39.     GetDate$ = theDate$ + sep$ + theTime$
  40. End Function
  41.  
  42.