Tuesday, December 11, 2012 12:42 PM
I need how to convert string to integer values, I have Hours:Minutes: Seconds values are String it's convert to integer seconds , I'd tried below expression but i got #ERROR
Function GetformatTimeAdd() as String
hours=( total ) \ 3600
mins =( total - hours * 3600) \ 60
sec=( total- hours * 3600-mins*60)
GetformatTimeAdd=hours.ToString("#,#0.##") & ":" & mins.ToString("#,#00.##") &":" & sec.ToString("#,#00.##") & ""
I wrote expression =Code..GetformatTimeAdd()
I got time
I did convert to Integer(Seconds)
but i got Error but i need 181561 seconds values
how to solve the problems
Please help me
- Edited by Emalai Tuesday, December 11, 2012 12:48 PM
Tuesday, December 11, 2012 1:21 PM
i'm confused, if you already have the hours, mins and sec why not just
seconds= hours * 3600 + mins * 60 + sec;
or if you have the string 50:26:01 as input to your function then
seconds=CInt(Mid(str,1,2))*3600 + CInt(Mid(str,3,2))*60 + CInt(Mid(str,6,2))
Hope this helps!
Tuesday, December 11, 2012 1:41 PMHi Emalai,
yes you'll get error message as you are trying to convert string to data format,
correct me if i'm wrong in understanding you requirement.. why are you trying to convert some hours/mins/secs to 00:00:00 format and then again using this format to find the diff in seconds again. May be instead of making them into 00:00:00 format you can directly convert all into single result i.e seconds which was what you needed .. hope this what you need :)
if not you can try using this alternate expression in solving your issue.
=split(Fields!TimeStamp.Value,":").GetValue(0) * 3600 +
split(Fields!TimeStamp.Value,":").GetValue(1) * 60 +
and the output will be as always.
Please feel free to revert back if any issue in using this method, thank you...
- Arun Gangumalla, Please mark as helpful or answered if it resolves your issue to help others in finding solutions easily.
Wednesday, December 12, 2012 4:32 AM
Thank you very much It's very helpful
Wednesday, December 12, 2012 4:36 AMThank you very much