Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change date from British to American?
Message
From
08/07/2021 14:28:54
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01681748
Message ID:
01681749
Views:
58
>Hi,
>
>Can you change the date from British to American using SET DATE command?
>
>For example, say you have a char column in a DBF like this:
>14/10/2020
>08/03/2012
>16/2/2020
>3/3/2010
>all the above characters show the date in a British format. Note the above are not dates but char representation of a date.
>Now I want to change them to American format (mm/dd/yyyy)
>Can it be done without many SUBSTR()?
>
>TIA

Yes, if you do SET DATE TO BRITISH, then use the CTOD() function you'll get the date values as you'd expect (assuming that the string you're passing to the CTOD() function are indeed formatted in dd/mm/yyyy format. You do have to be careful when changing setting like SET DATE -- it might cause existing code to break (if it's not coded to be independent of the SET DATE setting)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform