How to convert number to another

If I get input as 9:456 I need to change it to 09:45
Another example: 23:8 I need to change it to 23:08 so that I need only two numbers in before and after colon

@sruthesanju
we can use RegEx and fillup the result if needed

grafik

later we combine it with a :

Or Doing it with a oneliner:
grafik

1 Like

If it contains 2 number will it remain same for example if I have 23 will be 23 if I use above method

grafik

String.Join(":",{"\d{1,2}(?=:)","(?<=:)\d{1,2}"}.Select(Function (x) Regex.Match(“3:456”,x).ToString.PadLeft(2,"0"c)))

Ensure following:
grafik

1 Like