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"

有帮助吗?

解决方案

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

其他提示

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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top