Can't read time data from DB

32 Views Asked by At

I tried to read full date information in the DB file.

When I check the data using DBbrowser, it shows as below

Date
4/16/2016 16:39:10
4/19/2016 12:50:48
4/22/2016 16:12:24
4/25/2016 10:28:31
4/27/2016 10:51:30

But I can get only date with below code.

Date
4/16/2016
4/19/2016
4/22/2016
4/25/2016
4/27/2016

Macro:

Sub db_query()
'
' db_query Macro
'
Dim conn As Object, rst As Object

Worksheets("results").Range("A2:AI5001").Clear

Set conn = CreateObject("ADODB.Connection")
Set rst = CreateObject("ADODB.Recordset")

' OPEN CONNECTION
conn.Open "DRIVER=SQLite3 ODBC Driver;Database=D:\backup.db;"

strSQL = "SELECT date from Tb_Result_Summary"

' OPEN RECORDSET
rst.Open strSQL, conn, 1, 1

' OUTPUT TO WORKSHEET
Worksheets("results").Range("A2").CopyFromRecordset rst
rst.Close

' FREE RESOURCES
Set rst = Nothing: Set conn = Nothing

End Sub
0

There are 0 best solutions below