Last active
May 7, 2021 14:14
-
-
Save AlaeddineMessadi/b6b69454c9d79556348095f25f0d3592 to your computer and use it in GitHub Desktop.
function parseTime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseTime( | |
time: number | |
): { hours: number; minutes: number; seconds: number; milliseconds: number } { | |
const date = new Date(time); | |
const hours = date.getHours() + date.getTimezoneOffset() / 60 - 24; | |
const minutes = date.getMinutes(); | |
const seconds = date.getSeconds(); | |
const milliseconds = date.getMilliseconds(); | |
return { | |
hours, | |
minutes, | |
seconds, | |
milliseconds | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment