Take the 2-minute tour ×
    Dim SpssTextData As Variant
    Dim objDataDoc As ISpssDataDoc
    SpssTextData = objDataDoc.GetTextData("mydatecol", "mydatecol", 1, 1)

The result of SpssTextData should is of type Date but when when i read it it return a number ex: "12881203200" instead of "12/22/1990".

Apparently it is a format problem as explained in http://www.ats.ucla.edu/stat/spss/library/dates.htm in section "Formatting dates for display"

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

This was explained on the SPSS Community forums. This api does not return a formatted date: it returns the underlying numerical value.

share|improve this answer
I found a workaround. Had to convert the date to string. And from there convert it to date again with cdate(). –  A. Agius Oct 5 '12 at 5:59
add comment

I wrote some time ago this function. Surely it can be optimized.

Function spssDateToVBADate(d As Double) As Date
    Dim dias As Double, segundos As Double
    Dim f As Date
    dias = d / 86400#
    segundos = Int((dias - Int(dias)) * 86400)
    f = DateAdd("d", Int(dias), #10/14/1582#)
    spssDateToVBADate= DateAdd("s", segundos, f)
End Function
share|improve this answer
add comment

Your Answer


