Dears,
Could you please help to Convert Total Seconds to Days, Hours, Minutes and Seconds? Thanks in Advance
Dears,
Could you please help to Convert Total Seconds to Days, Hours, Minutes and Seconds? Thanks in Advance
@hsendel
Welcome to Uipath Community
Great…thats really a good question to start with
so to get the hours, minutes, seconds from seconds, with seconds saved in a variable of double datatype named for example in_Seconds then
Timespan.FromSeconds(in_Seconds)
For example
Timespan.FromSeconds(12345)
gives us
03:25:45
–simply write this in a write line activity like Timespan.FromSeconds(12345).ToString
You will get to know the answer…
Hope this would help you buddy
Cheers…!
Thanks a lot C.Ciprian, Will be useful when dealing with “Invoke Code” Functionality
Thanks Palaniyappan, it’s exactly answering my request , still only one issue, as I’m using String Variable for “In-Seconds” instead of Integer.
I tried to convert this string to integer as follows :
You don’t need to use Invoke Code, because you can use the vb.net in expression fields such as the Assign activity.
Take this example:
You can put that in an Assign activity like this:
yourtimespan = new TimeSpan(TimeSpan.TicksPerSecond * yourseconds)
yourtimeString = yourtimespan.Hours.ToString("00") + ":" + yourtimespan.Minutes.ToString("00") + ":" + yourtimespan.Seconds.ToString("00")
but, I would go with palaniyappan’s idea since it’s simpler.
Make sure the variable TimeDiff is a number or it won’t convert. Also use Long type, not Integer, since seconds can be large.
Thanks ClaytonM, How To Choose Long Type, because my issue solved when changing TimeDiff to Double but I got the following : Write Line: Value was either too large or too small for an Int32.
Thanks a lot Dears, My Problem Totally fixed, after Changing int32 to int64 as per ClaytonM Suggestion:
cool
You can also use vb to convert to Long type with CLng(TimeDiff)
How do i get this from a variable that is a string :)?
Please can you help…
We can store this in a string variable
And get the input as well from a string variable
Cheers @J_Swali
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.