Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Military Time
Message
 
 
To
01/08/2007 16:25:48
John Baird
Coatesville, Pennsylvania, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01245247
Message ID:
01245269
Views:
24
>Have you been in the military? First of all, your function does not work with real military time. Military time is NOT expressed as 13:30.... its expressed as 1330 hours. 2400 hours is midnight only and 0001 is 1 minute after midnight. Plugging these values into your function does not return the correct value. If you want it to be capable of handling the ':', you need to do some reworking.

In the sample Jay showed there was : between values. If we use 1330 or 2400 without : then just two first statements have to be modified and : should be added.

How 0101 is handled? Do we always have 0s?

E.g.
lparameters tcTime
 if ':' $ m.tcTime
   * proceed with GetWordNum
  else
     * assuming 0 in front - if not, needs a bit more processing
     lnHours = int(val(left(m.tcTime,2))
     lcMins = right(m.tcTime,2)
  endif 

* The rest of the logic should carry on, don't forget to add :
Actually, looks like it would require a bit more changes. So, from the quick glance the handling of 24:00 format and 2400 format (real military time) should be different.

Since my function was the longest anyway, I leave the exercise to write a new version that can handle both formats to the reader.

Thanks.
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