How to convert to time format

how to convert to time format
like 910 to time format 09:10:00

One can use DateTime.ParseExact(yourtime, “HHmm”, Nothing) in the assign activity.

DateTime.ParseExact can be used for date/time conversions.

2 Likes

First Check Length of it… it should be 4

Then use can use this function to parse…DateTime.ParseExact(“0909”, “HHmm”, Nothing)

It should be 4 else it cant recognize which is ur time…

Ex: if u pass 101, it dont whether it is 01:01 or 10:01…

2 Likes

That’s correct.
There’s a “trick”, if you know that leading 0 might be omitted:
DateTime.ParseExact(yourTime.PadLeft(4, "0"c), "HHmm", Nothing)

Also please note that if no date is specified, returned Date variable will have yourTime with today’s date.

2 Likes

Hi, my variable(12 hour format) is like 12.00 or 2.00
I tried your above code. For the second timing(2.00), it gives me an error saying string was not recognised as datetime. Pls help