Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date conversion
Message
From
07/09/2007 16:13:07
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01253009
Message ID:
01253126
Views:
21
>>>I have a dbf table created from excel with date data in a char field(10) in a format of '2011-04-1"
>>>
>>>How would I convert this to regular foxpro data field format?
>>
>>
>>lcDate = '2011-04-1'
>>? ctod('^' + m.lcDate)
>>
Cetin
>
>That worked, but not sure how that trick works.

When a literal or date/datetime starts with ^ it specifies Year/Month/Day ordering and /-.space can be used as delimiters. It provides a date settings indepedant entry. VFP allows interesting literals to be accepted as a date/time. ie:

{^2007 1 31}
{^/1/31}

both mean Jan 31,2007 (assuming current year is 2007 for the latter). This is valid too:

{^2007/1/31 10p} - close to what humans like:)
lcDate = '2011-04-1'
'^' + m.lcDate && makes that '^2011-04-1' ctod to convert to date.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform