Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Military Time
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01245247
Message ID:
01245287
Views:
23
>>How can I convert the following to non-military time? And yes, before the jokes start, the "13:45" is a value in an array. I can't just retype it to "1:45" instead. Thanks!
>>
>>
>>(RIGHT( "0" + ALLTRIM( "13:45" ), 5 ))
>>
>
>If you like a complicated way, assuming you have set hours 12 (although it works for me with set hours 24 contrary of what the help says, or I am reading too fast)
>
>
>lcTime = '13:45'
>? Ttoc(Ctot(Transform(Dtos(Date()), '@R 9999-99-99') + 'T' + lcTime), 2)
>
Your code only works if SET HOURS is set to 12.

So, you would have to change it back and forth.

However, yours would be the simplest to adjust to the real military time by just stuffing : .

And actually all other variations as well, stuff : and everything would work as is :)

E.g.
if not ':' $ m.lcTime
   lcTime = STUFF(m.lctime,3,0,':')
endif
* Proceed with the logic.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform