Author Topic: 24 Hour Clock  (Read 12771 times)

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
24 Hour Clock
« on: May 12, 2008, 02:54:41 AM »
Hi,  I would like to add a 24H six digit clock to my project, I have looked at the example in the usr directory but when the time is using single numbers i.e 7:9:4 it doesn't look very professional.

Ideally I would like a 24H clock that uses six digits to represent the time in the above example i.e. 07:09:04., or 19:09:04.   I have tried adding some code to the above example by adding a "0" in front of the time[1] number if it is lower than 10  but I'm pulling my hair out trying to get it to work.....

Any assistance appreciated.




support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:24 Hour Clock
« Reply #1 on: May 12, 2008, 11:05:34 AM »
You can use:

STR$(TIME[1],2)+":"+STR$(TIME[2],2)+":"+STR$(TIME[3],2) to get fixed two digit display.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Petty_boy

  • Jr. Member
  • **
  • Posts: 53
  • I'm a llama!
    • View Profile
Re:24 Hour Clock
« Reply #2 on: May 12, 2008, 02:01:21 PM »
Hi Many thanks.