FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaScriptNote/basic/integer_to_time.js at master · mbrsagor/JavaScriptNote · GitHub
mbrsagor
/
JavaScriptNote
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
5
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaScriptNote
/
basic
/
integer_to_time.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
14 lines (9 loc) · 486 Bytes
Breadcrumbs
JavaScriptNote
/
basic
/
integer_to_time.js
Copy path
File metadata and controls
14 lines (9 loc) · 486 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
// Assume you have a big integer for time in milliseconds
const
bigIntTime
=
1672531199000n
;
// JavaScript BigInt, for example
// Convert BigInt to regular number if it's safe (less than MAX_SAFE_INTEGER)
const
timeInMilliseconds
=
Number
(
bigIntTime
)
;
// Create a Date object from the milliseconds
const
date
=
new
Date
(
timeInMilliseconds
)
;
// Format the date to a readable format
const
formattedDate
=
date
.
toISOString
(
)
;
// "2023-01-01T00:59:59.000Z"
console
.
log
(
formattedDate
)
;
Back
|
FazBrowse Home
|
New Git URL