Converting unique timestamp PT0H30M into a value I can work with

I need to convert this value (PT0H30M) into a number I can easily sum across all records and be able to get a simple solution to display hours and mins easily so that it is clear to the viewer.
SS-SMGB-TimeConv.jpg
RUA Volunteer2?Tableau Trainer & Consultant Sales Exec.Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bdreed35Commented:
Can you provide what the expected output is for the different examples?
0
RUA Volunteer2?Tableau Trainer & Consultant Sales Exec.Author Commented:
The expected output would be a number that I can sum and or divide back into an hour minute format. I guess if you converted it then added only minutes then I could just devide by 60 and get all the hours and the remainder would be the minutes.
0
mlmccCommented:
Try this formula

WhilePrintingRecords;
Local NumberVar MyHours := 0;
Local NumberVar MyMinutes := 0;
Local StringVar MyTime := {YourTimeField};
Local NumberVar H_Loc;

MyTime := Mid(MyTime,3);
H_Loc := InStr(MyTime,'H');
MyHours := Val(Left(MyTime,H_Loc-1));
MyTime := Mid(MyTime,H_Loc+1);
MyMinutes := Val(Left(MyTime,Len(MyTime)-1));

If MyHours <> 1 then
    CStr(MyHours,0,'') & ' Hours and ' & CStr(MyMinutes,0,'') & ' Minutes'
else
    CStr(MyHours,0,'') & ' Hour and ' & CStr(MyMinutes,0,'') & ' Minutes'

mlmcc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RUA Volunteer2?Tableau Trainer & Consultant Sales Exec.Author Commented:
Works perfectly. Thank you sir. I am employed for yet another week. Hopefully my job will not get shipped to India.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.