Reputation: 1840
I want to perform a transformation using luxon from milliseconds to minutes.
For eg. if i enter 1000 , te output should be 1m 0s.
I am trying Duration.fromMillis(1000).as('minutes')
but in return i am getting 0 output. Is there any other way i can achieve the same thing
Upvotes: 4
Views: 7174
Reputation: 80
@snickersnack comment should be accepted as answer, as it states a very useful way to play with luxon:
Duration.fromMillis(4515000).shiftTo("hours","minutes","seconds").toObject()
Will create an object:
{ hours: 1, minutes: 15, seconds: 15 }
Than you can do what you need
Upvotes: 2