Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Importing Excel Files - Date Problem
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00548892
Message ID:
00548912
Views:
24
Excellent!!! Thanks for the quick answer.

>Excel keeps dates internaly as serialized number. You can convert it to date by using following function
>
>*  Purpose  Convert Serialized-Number-to-Date into Date
>*  Param's  Serialized Number
>*  Return  Correspondet date in the date format
>*
>*     Note  1. We are using Foxpro ability to do arithmetic with dates
>*           2. We are assuming that the serialized number 1
>*		corresponds to the date 12/31/1899
>
>PARAMETER pvSerNum, pdBaseDate
>
>PRIVATE dBaseDate, nSerNum
>nSerNum = IIF(TYPE("pvSerNum")="C", VAL(pvSerNum), pvSerNum)
>dBaseDate = IIF(EMPTY(pdBaseDate), {12/31/1899}, pdBaseDate)
>RETURN dBaseDate + nSerNum - 1
You can also save excel spreedsheet as CSV file and than import into VFP.
>
>
>>I'm trying to import from an excel file. Everything works fine except the date. The worksheet has the date stored in a custom field that looks like this:
>>
>>mm"/"dd"/"yyyy
>>
>>On the worksheet it looks like a normal date (01/01/2001).
>>
>>When it gets imported into a VFP date field, the value is " / / ", when I use a character field, I get some 5 digit number that doesn't seem to resemble the date to me.
>>
>>Can anyone shed some light on this for me. I need to know how to import this into a VFP table without manual manipulation.
>>
>>Thanks.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform