Hi Folks.
I have a var that holds a time value as a string formatted as hh:mm:ss. I need to be able to parse that value into separate vars so I can perform the math to break it all down to total seconds. Once I have my total seconds I'll be able to do the rest of my math and convert any results back into hh:mm:ss, but my problem is not knowing how to parse out the values from my string. I'm pretty sure someone is going to say RegEx, which I'm looking at but I'm very confused by this command and this thing called easypatterns isn't helping make anything clearer for me.
If someone can get me started I'd be most grateful.
Converting hh:mm:ss to seconds.
Moderators: Dorian (MJT support), JRL
- Dorian (MJT support)
- Automation Wizard
- Posts: 1380
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: Converting hh:mm:ss to seconds.
That would be hours x 3600 + mins x 60 + secs :
Code: Select all
//4hrs 15mins 30secs
Let>time=4:15:30
separate>time,:,elements
//=15330 secs
let>totalseconds={(%elements_1%*3600)+(%elements_2%*60)+(%elements_3%)}
Yes, we have a Custom Scripting Service. Message me or go here