Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: NT
Expertise: Beginner
Dec 4, 1998

NT Date Format

Question:
I am trying to develop a VB program to interface with a database from a third-party imaging product. The database is SQL Server and the product stores dates as 8-byte binary values (it does not use the SQL Server date format). I've spoken with their technical support and they tell me that the dates are in the "standard" NT system date format; however, I cannot find anything on Microsoft's Web site that documents this format. Examples of what I am looking at are as follows:

01BD2AB6829D4000

Answer:
I suspect that what the info is stored in is a FILETIME structure. If so, the following should work for you. The number you gave translated to 1/27/1998.


Private Type FILETIME
   dwLowDateTime                 As Long
   dwHighDateTime                As Long
End Type

Private Type SYSTEMTIME
   wYear                         As Integer
   wMonth                        As Integer
   wDayOfWeek                    As Integer
   wDay                          As Integer
   wHour                         As Integer
   wMinute                       As Integer
   wSecond                       As Integer
   wMilliseconds                 As Integer
End Type

Private Declare Function FileTimeToSystemTime _
   Lib "kernel32" _
   (lpFileTime As FILETIME, _
    lpSystemTime As SYSTEMTIME) As Long
    
Private Sub Command1_Click()
   Dim plngRtn             As Long
   Dim ptypSystemTime      As SYSTEMTIME
   Dim ptypFileTime        As FILETIME
   
   ptypFileTime.dwLowDateTime = &H829D4000
   ptypFileTime.dwHighDateTime = &H1BD2AB6
   
   plngRtn = FileTimeToSystemTime(ptypFileTime, _
                                  ptypSystemTime)
   
   Debug.Print ptypSystemTime.wMonth & "/" & _
               ptypSystemTime.wDay & "/" & _
               ptypSystemTime.wYear & "   " & _
               ptypSystemTime.wHour & ":" & _
               ptypSystemTime.wMinute & ":" & _
               ptypSystemTime.wSecond & ":" & _
               ptypSystemTime.wMilliseconds
End Sub
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date