Question

    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"

Was it helpful?

Solution

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

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top