# How to convert output time in terms of seconds to minute with UnitConvert[]? [duplicate]

I have this code:

AbsoluteTiming[g[x_, t_] := Sin[x]^90*(1 + t^2);
Integrate[g[x, \[Tau]], {\[Tau], 0, t}]]


with this output:

I want to have convert unit to minute. This is a part of code, I have a formula in iteration. Any suggestion with UnitConvert[] ?

• Why not divide by 60, or use UnitConvert[]? Jul 6, 2016 at 8:53
• @ J.M. When I use of UnitConvert[] I do not have output for Integral. I have just minute. For example I have problem with this code : UnitConvert[ AbsoluteTiming[g[x_, t_] := Sin[x]^90*(1 + t^2); Integrate[g[x, \[Tau]], {\[Tau], 0, t}]], MixedRadix["Minutes", "Seconds"]]. Jul 6, 2016 at 9:05
• Your use of MixedRadix[] confuses me, this is only useful when the duration is more than 1 minute, and you want to convert the output to minutes+seconds. Jul 6, 2016 at 9:08
• @J.M. "Minutes" or "Minutes, Seconds" . If possible for you please consider this code: UnitConvert[ AbsoluteTiming[g[x_, t_] := Sin[x]^90*(1 + t^2); Integrate[g[x, \[Tau]], {\[Tau], 0, t}]], "Minutes"] Jul 6, 2016 at 9:10
• @Karsten I reviewed that question, but I did not use for my code. Jul 6, 2016 at 9:35

As far as I am aware, AbsoluteTiming[] gives only answers in seconds, so you need to do this manually

MapAt[UnitConvert[# Quantity["Seconds"], "Minutes"] &,
AbsoluteTiming[g[x_, t_] := Sin[x]^90*(1 + t^2);
Integrate[g[x, \[Tau]], {\[Tau], 0, t}]], 1]


{Quantity[0.000146967, "Minutes"], t Sin[x]^90 + 1/3 t^3 Sin[x]^90}

• Many thanks, but I want to use of UnitConvert. Because I have iteration formula and I do not have output for every frequency. Jul 6, 2016 at 8:59
• I'd have used MapAt[] instead for this: expr // MapAt[Quantity[#/60, "Minutes"] &, 1] Jul 6, 2016 at 12:50
• @J.M. Yes, edited to MapAt[] which uses UnitConvert[] though, as he specified its usage. Jul 6, 2016 at 14:00