Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export function number2Time(number) {
- const hour = parseInt(parseInt(number, 10) / 60, 10);
- let min = parseInt(number % 60, 10);
- if ( min < 10) {
- min = '0' + min;
- }
- if (hour > 12) {
- return (hour - 12) + ':' + min + ' PM';
- }
- if (hour === 12) {
- return hour + ':' + min + ' PM';
- }
- return hour + ':' + min + ' AM';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement