Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting TIME() to a readable format
Message
 
 
To
21/09/2008 14:09:02
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01349313
Message ID:
01349337
Views:
19
I would rather use code that is SET independent
DO CASE 
CASE LEFT(lcTime,2) = "00"
	lcNewTime = STUFF(lcTime,1,2,"12") + " AM"
CASE LEFT(lcTime,2) < "12"
	lcNewTime = lcTime + " AM"
CASE LEFT(lcTime,2) > "12"	
	lcNewTime =  PADL(INT(VAL(lcTime)-12),2,"0") + RIGHT(lcTime,6) + " PM"	
OTHERWISE
	lcNewTime = lcTime + " PM"
ENDCASE


? lcNewTime	
>Mine returns:
>
>14:03:13
>
>I need:
>
>02:03:13 PM
>
>I'm sure it's due to the environmental settings, but that's what they are set to.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform