title: How to get SQL Server DateTime field in ODBC native client
body: <p>I'm have SQL Server table:</p>
  
  <pre><code>CREATE TABLE [dbo].[Table1](
      [rec_id] [int] IDENTITY(1,1) NOT NULL,
      [id] [int] NOT NULL,
      [date] [datetime] NOT NULL,
      [ps] [varchar](200) NULL
  ) ON [PRIMARY]
  </code></pre>
  
  <p>I'm getting data by a code:</p>
  
  <pre><code>status = SQLExecDirect(statement, (SQLWCHAR*)TEXT("SELECT * FROM [DBNAME].[dbo].[Table1]"), SQL_NTS);
  cout &lt;&lt; "SQLExecDirect returned " &lt;&lt; status &lt;&lt; "\r\n";
      if (status == SQL_SUCCESS_WITH_INFO || status == SQL_SUCCESS)
      {
          int rec_id;
          int id;
          char date[64];
          char ps[201] = { 0 };
          while (SQLFetch(statement) == SQL_SUCCESS)
          {
              SQLGetData(statement, 1, SQL_C_ULONG, &amp;rec_id, 0, NULL);
              SQLGetData(statement, 2, SQL_C_ULONG, &amp;id, 0, NULL);
              SQLGetData(statement, 3, SQL_C_CHAR, date, 64, NULL);
              SQLGetData(statement, 4, SQL_C_CHAR, ps, 201, &amp;len);
              cout &lt;&lt; rec_id &lt;&lt; " " &lt;&lt; id &lt;&lt; " " &lt;&lt; date &lt;&lt; " " &lt;&lt; ps &lt;&lt; " " &lt;&lt; len &lt;&lt; endl;
          }
      }
      cout &lt;&lt; "Connected;";
      cin.get();
      SQLDisconnect(connectHandle);
  </code></pre>
  
  <p>But I'm get <code>date</code> field as char array in output: 2014-01-01 00:00:00.000
  How to get this field, for example, in FILETIME format or in other more convenient C++ data type? Thanks.</p>