Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date type
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01644735
Message ID:
01644738
Views:
78
>I am just about completing a fairly extensive import utility of CSV files, and have a potential concern about this type of date found as a character (I was thinking there was a built in VFP way to make this conversion, but can't remember what it was) :
>
>December 12, 2016 or Dec. 12, 2016
>
>If I allow a user to select the above as a Date field, I need to convert it to a normal 12/12/2016 which is stored as a date field in the table. Anyone know the best way to do this? I will not know ahead how the date is stored and will be testing it before appending it to the actual date field in the table.

idea...
DEFINE CLASS...
   cMonths=",jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec,"

   PROCEDURE FormatDT(INPREF lcDT)
      *!*   <pdm_sc_yes/>
      *!*   <pdm_dd_yes/>
      LOCAL liMonth,lcRet
      liMonth=ATC(","+LEFT(m.lcDT,3)+",",This.cMonths)
      liMonth=OCCURS(",",LEFT(This.cMonths,m.liMonth))

      IF AT(":",m.lcDT)>0 && Time 
         lcRet=EVALUATE("{^"+STR(YEAR(DATE()))+"-"+;
               LTRIM(STR(m.liMonth,2))+;
               "-"+LTRIM(SUBSTR(m.lcDT,5,2))+" "+SUBSTR(m.lcDT,8,5)+":00}")
      ELSE
         lcRet=EVALUATE("{^"+SUBSTR(m.lcDT,9,4)+"-"+;
               LTRIM(STR(m.liMonth,2))+;
               "-"+LTRIM(SUBSTR(m.lcDT,5,2))+" 00:00:00}")
      ENDIF
      RETURN m.lcRet
   ENDPROC
ENDDEF
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform