Platform
Resources
Pricing
Sign in
Get started
Michael Cooper
Developer @Observable
Workspace
Fork
Public
By
Michael Cooper
Edited
Oct 14, 2022
10 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
ms
(
"1d"
)
Insert cell
Insert cell
Insert cell
ms
(
12345678
)
Insert cell
Insert cell
Insert cell
Insert cell
ms
(
12345678
,
{
long
:
true
}
)
Insert cell
Insert cell
ms
=
(
await
import
(
"https://cdn.skypack.dev/ms@2.1.3?min"
)
)
.
default
Insert cell
Insert cell
exampleMsExact
=
{
let
rem
,
hours
,
minutes
,
seconds
;
[
hours
,
rem
]
=
intFrac
(
exampleMs
/
ms
(
"1h"
)
)
;
[
minutes
,
rem
]
=
intFrac
(
rem
*
60
)
;
[
seconds
,
rem
]
=
intFrac
(
rem
*
60
)
;
return
{
hours
,
minutes
,
seconds
,
ms
:
Math
.
round
(
rem
*
1000
)
}
;
}
Insert cell
intFrac
=
(
n
)
=>
{
let
int
=
Math
.
floor
(
n
)
;
return
[
int
,
n
-
int
]
;
}
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
millisecondsInput
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
ms
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
exampleMs
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
exampleMsExact
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
intFrac
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML