Think of something that you wish Authorware could do but it doesn't?  Let the our good friends at Macromedia know via the wishlist.

Please let us know if you find any of the materials on this site inappropriate or offensive. Please include the url and why the material should be reviewed.

Comments and questions about the site are also welcome. Please no Authorware questions, use the AWARE list.

Back

B1010 - How do I show a properly formatted real-time clock?

by - Joseph Ganci


We wish to emulate the time clock on our mainframe system which always displays four digits -- two digits for hours, a colon, and two digits for minutes (HH:MM). The Microsoft Windows system drops zeros whenever they appear as the first digit of either Hour or Minute variables. How do we do this?

Here's what you can embed on the screen to do what you want. If you need a 24-hour clock, military time:

{Test(Hour < 10 , "0" , "")}{Hour}:{Test(Minute < 10 , "0" , "")}{Minute}

If you want a 12-hour clock:

{Test(Hour > 9 & Hour < 13 | Hour > 21 , "" , "0")}{Test(Hour < 13, Test(Hour > 0 , Hour, 12) , Hour - 12)}:{Test(Minute < 10 , "0" , "")}{Minute}

If you want an AM or PM to appear after the 12-hour time, append to the script right above with:

{Test(Hour > 11 , "PM" , "AM")}

Be sure to choose the Icon Properties for the Display icon in which you're using the above script and select the Update Displayed Variables option. Your time will show on the screen beautifully.

There are 0 reviews
Add your review
Back