Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export function timestampToFormattedDate(timestamp: number): string {
- const date = new Date(timestamp * 1000);
- return `${ date.getDate() }.${ date.getMonth()+1 }.${ date.getFullYear() }`;
- }
- export function timeLabelFromSeconds(seconds: number): string {
- if (seconds >= 3600) {
- // hh:mm:ss
- return new Date(seconds * 1000).toISOString().slice(11, 19);
- } else {
- // mm:ss
- return new Date(seconds * 1000).toISOString().slice(14, 19);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement