Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date String to Date
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00054810
Message ID:
00054813
Views:
29
AFAIK, there's no such function as STOD() (inverse of DTOS()). The easiest way I know:
PARAMETER tcDate

LOCAL lcOldDate, lcDate, ldReturn
lcOldDate = SET("DATE")
SET DATE TO YMD

lcDate = STUFF(tcDate, 7, 0, "/")
lcDate = STUFF(lcDate, 5, 0, "/")
ldReturn = CTOD(lcDate)

SET DATE TO (lcOldDate)

RETURN ldReturn
Vlad

>I'm working on an App which will be used in several countries. We need to store several dates in a character field in our System Preferences table, so I assumed dtos(MyDate) would be the same no matter what format users have for dates. Easy, so far.
>
>Unfortunately, we need to use those dates AS dates, and I can't find a simple way to return the '19971031' format to a date variable in the same date format as the user's Windows. I need a function that reverses dtos(). I've written a work-around by changing date format to AMERICAN and then re-setting it to the user's preference, but there HAS to be a simpler, more elegant way.
>
>Different users on the same site may use different date formats :-(
>
>Ideas? Or have I missed an obvious function when I looked in Help?
>
>TIA
>Barbara
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform