12 hour clock on 450

Discuss issues and ideas you have to configuring displays with PowerVision
highlandranger
Posts: 3
Joined: Fri Aug 05, 2011 3:17 pm

12 hour clock on 450

Post by highlandranger » Fri Dec 23, 2011 4:41 pm

I want to be able to display a 12 hour clock on a config that I am building. What would be the best way to do that? For example:

0800 would be 8:00 AM while 1600 would be 4:00 PM

Thanks!
ksaenz
Enovation Controls Development
Enovation Controls Development
Posts: 263
Joined: Thu Aug 19, 2010 7:53 am

Re: 12 hour clock on 450

Post by ksaenz » Tue Jan 03, 2012 8:55 am

Hello highlandranger,

You are going to need to create two user variables.

One to hold the hours from 1 -12 and calculate it like this:

Code: Select all

mod("RealTimeClock.Hour"+11, 12) + 1
You can display this variable with a text gauge.

And another one to know if it is AM or PM and calculate it like this:

Code: Select all

if("RealTimeClock.Hour">11, 1, 0)
You can use this variable for the visible condition of "AM" and "PM" text widgets.

*EDIT
You don't even need the second variable, the visible conditions for "AM" and "PM" can look at the "RealTimeClock.Hour" variable directly.

Regards,
ksaenz