×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

VB Math Functions

VB Math Functions

VB Math Functions

(OP)
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

RE: VB Math Functions

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: www.essexsteam.co.uk

RE: VB Math Functions

(OP)
Thanks Johnwm.

I have implemented this code. Exactly what I was looking to do. I didn't think I'd be that simple.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources