7 examples of 'millisecond timestamp' in JavaScript

Every line of 'millisecond timestamp' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
6function getTimestampMilliseconds() {
7 return (new Date()).getTime();
8}
18static getTimestampMilliseconds():number
19{
20 return getTimestampMilliseconds();
21}
10static getTimestampMilliseconds() {
11 return (new Date()).getTime();
12}
68export function timestampFromMillis(epochMilli: number): Timestamp {
69 return {
70 seconds: Math.floor(epochMilli / MILLIS_PER_SECOND),
71 nanos: (epochMilli % MILLIS_PER_SECOND) * NANOS_PER_MILLI,
72 };
73}
385function saveTimestamp (millisecond) {
386 if (timeseries.has(millisecond)) {
387 timeseries.set(millisecond, {"x": millisecond, "y": timeseries.get(millisecond).y + 1})
388 } else {
389 timeseries.set(millisecond, {"x": millisecond, "y":1})
390 }
391}
104static fromMillis(milliseconds) {
105 const seconds = Math.floor(milliseconds / 1000);
106 const nanos = (milliseconds - seconds * 1000) * MS_TO_NANOS;
107 return new Timestamp(seconds, nanos);
108}
30static fromMillis(milliseconds: number): Timestamp {
31 const seconds = Math.floor(milliseconds / 1000);
32 const nanos = (milliseconds - seconds * 1000) * 1e6;
33 return new Timestamp(seconds, nanos);
34}

Related snippets