Jump to content

Display number with padded zeros


golfjrr
 Share

Recommended Posts

I know this should be simple but alas..

I have a field of say minutes that is 5 but want to force it to be displayed in a string like 03:05:44 with the padded zeros. Now it is showing like 3:5:44.

How do I do that in autoit? I basicall have separate fields for hours, minutes and seconds, and concat them together hh:mi:ss but of course don't get the leading zeros.

The stringformat command has gotta be the most counterintuative/confusing way to format things I have ever seen in my 30+ years of programming..

Link to comment
Share on other sites

  • Developers

StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)

<{POST_SNAPBACK}>

Thank you. I knew it should be simple. I'm not a c programmer and I guess that function/format is taken more from a c function thus it was greek to me. To a c programmer no doubt trival
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...