>I have a problems with dates when I try to import Excel 2007 files (not tested with earlier versions).
>
>So I have this:
>
>
>local loConnDataSource
>loConnDataSource = createobject('ADODB.Connection')
>lcFileName = GETFILE("XLSX")
>TEXT TO lcConnectionString NOSHOW TEXTMERGE PRETEXT 15
> Provider=Microsoft.ACE.OLEDB.12.0;
> Data Source=<<m.lcFileName>>;
> Extended Properties="Excel 12.0;HDR=NO;IMEX=1;";
>ENDTEXT
>loConnDataSource.ConnectionString = m.lcConnectionString
>loConnDataSource.Open()
>
>oCA = CREATEOBJECT("CursorAdapter")
>oCa.DataSource = createobject('ADODB.RecordSet')
>oCa.DataSource.CursorLocation = 3
>oCa.DataSource.LockType = 3
>oCa.DataSource.ActiveConnection = loConnDataSource
>
>
>oCa.CursorFill()
>BROWSE NORMAL
>
>
>Everything is OK, but date columns in Excel.
>Depending of chosen format I have:
>
>20.09.2009 '3.' && And what is this '3.' is above me :-)
>Wednesday, 20 September 2009
>and many others.
>
>How Can I tell this recordset to returns DATE not the whatever excel wants.
>I forgot to mention that I have NO idea what type of data there will be in that Excel file beforehand, so I can't use CursorSchema. Don't want to use automation also :-)
Hi Boris,
Might that be time portion, cut off?
If creators of excel doesn't format those as date columns then would have problems I think.
What does oCA.DataSource.Fields("yourDateField").Type show? Is that date/time? 7,133,134,135 ?
Cetin