Reputation: 348
What I have -> 1m16.044455998s
What I want -> 1m16s without milli-, micro-, nano- seconds.
Upvotes: 1
Views: 907
Reputation: 1949
Use this
time.Since(t1).Truncate(time.Second).String()
Check this go playground link for an example: https://play.golang.org/p/x7k9zuuqpRp
Upvotes: 6