How to convert to time format


#1

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


#2

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

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


#3

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…


#4

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.