Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change time string to am/pm
Message
From
01/08/2022 09:59:38
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01684752
Message ID:
01684753
Views:
39
>Hi,
>
>Say I store the value of time in a string (e.g. "20:01" for 8:01pm). In a report, I would like this time to be shown in an American format, am/pm. I can display this time using CTOT(cTimeString) but it also shows a date (the current date).
>Is there a way to use CTOT() and make sure that the DATE part is not showing?
>
>TIA

if you add second parameter of 2 to TTOC() you get just the string value representing the time portion of a datetime value. This value in turn is affected by the SET HOURS setting,
nSetHours = SET("HOURS")    && remember original setting
tTest = {^2022.08.01 14:32:25}
SET HOURS TO 24
? TTOC(m.tTest,2)
SET HOURS TO 12
? TTOC(m.tTest,2)
SET HOURS TO (m.nSetHours)   && restore original setting
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform