devxlogo

NT Date Format

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 LongEnd TypePrivate 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 IntegerEnd TypePrivate 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.wMillisecondsEnd Sub

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist