Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Math Functions

Status
Not open for further replies.

Electromechanical30

Industrial
Joined
Sep 15, 2004
Messages
45
Location
US
Hello,

I am currently creating a SCADA system. Part of the program will read from the timer registers of a PLC. Since the PLC Timer acc and pre values are in seconds, I need to write some code that will display a HR:MIN value in a txtBox. The operator shouldn't have to try to figure out how long 5400 sec is... Any examples or web links would be great. I am fairly proficient in VB, but I don't know the proper syntax for complex mathematical operations.

Regards,
jMk
 
I would use the Format function, thus:

Code:
intSeconds = 5403
strTime = Format(intSeconds/86400,"hh:mm:ss")
MsgBox strTime
will produce:

01:30:03

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

UK steam enthusiasts:
 
Thanks Johnwm.

I have implemented this code. Exactly what I was looking to do. I didn't think I'd be that simple.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top