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:
00549387
Views:
25
Actually, I only used this line:

dBaseDate = IIF(EMPTY(pdBaseDate), {12/31/1899}, pdBaseDate)
RETURN dBaseDate + nSerNum - 1

and changed it to this:

ldCloseDate = date(1899, 12, 31) + lnExcelDate -1

Seems to work fine - thanks again for the help!

>I forgot to mention that it's old foxpro dos working code. You'll have to clean it up for VFP yourself :)
>
>>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform