Article ID: 186265
Article Last Modified on 3/14/2005
DATEPART(portion, datetime)
Ms for Milliseconds Yy for Year Qq for Quarter of the Year Mm for Month Dy for the Day of the Year Dd for Day of the Month Wk for Week Dw for the Day of the Week Hh for Hour Mi for Minute Ss for Second
SELECT Pubdate, DATEPART(Ms, Pubdate) FROM Titles
Dim rs As New ADODB.Recordset
Dim strSql As String
Dim strCnn As String
strCnn = "DSN=Pubs;UID=<username>;PWD=<strong password>;DATABASE=Pubs"
strSql = "SELECT pubdate, datepart(Ms,pubdate) FROM titles"
rs.Open strSql, strCnn, adOpenKeyset, adLockOptimistic
rs.MoveFirst
Debug.Print "PubDate", "Milliseconds"
Do Until rs.EOF
Debug.Print rs(0), rs(1)
rs.MoveNext
Loop
rs.Close
Keywords: kbhowto kbdatabase KB186265