func calculateTimeUsingFormatter(seconds : Int) -> String
{
let formatter = DateComponentsFormatter()
formatter.unitsStyle = .abbreviated
formatter.zeroFormattingBehavior = .pad
formatter.allowedUnits = [.year, .month , .day, .hour , .minute]
let minutes1 = seconds / 60
let timeInterval = TimeInterval(minutes1 * 60)
return formatter.string(from: timeInterval)!
}
我输入了:
24 * 395 * 60 * 60 + 48 * 60 * 60 + 60 + 60 * 60 + 31 + 60 * 60
然后我输出了一个输出:
1y 1m 1d 2h 1m
但我需要一个实际的输出:
1y 1m 1d 2h 1min
你能帮我吗?