10 examples of 'timestamp to date javascript' in JavaScript

Every line of 'timestamp to date javascript' 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
3export function timestampToDate(timestamp?: pb.google.protobuf.ITimestamp) {
4 let millis: number
5 if (!timestamp) {
6 millis = 0
7 } else {
8 millis = timestamp.seconds as number * 1e3 + timestamp.nanos / 1e6
9 }
10 return new Date(millis)
11}
13getTimestamp (date) {
14 return new Date(
15 date.getFullYear(),
16 date.getMonth(),
17 date.getDate(),
18 this.time.hour,
19 this.time.min,
20 0, 0)
21}
78export function toDate(stamp: Time): Date {
79 const { sec, nsec } = stamp;
80 return new Date(sec * 1000 + nsec / 1e6);
81}
12toJsDate() {
13 return new Date(this._value.getTime()); // return a clone.
14}
8export function formatDate(timestamp: number): string {
9 const date = new Date(timestamp);
10 return date.toLocaleDateString("de", {
11 day: "2-digit",
12 month: "2-digit",
13 year: "numeric",
14 });
15}
90export function timeStampDate(timeStamp) {
91
92 if (typeof timeStamp === "string") {
93 return timeStamp.replace(/T.+/, "");
94 }
95
96 return timeStamp;
97}
200public toJavaScriptDate(implicitTimezone = undefined): Date {
201 const timezoneToUse =
202 this._timezone || implicitTimezone || DayTimeDuration.fromTimezoneString('Z');
203 return new Date(
204 Date.UTC(
205 this._years,
206 this._months - 1,
207 this._days,
208 this._hours - timezoneToUse.getHours(),
209 this._minutes - timezoneToUse.getMinutes(),
210 this._seconds + this.secondFraction
211 )
212 );
213}
182static date(timestamp) {
183 return new Date(timestamp * 60 * 1000);
184}
31static getDate(timestamp: number): string {
32 return Moment.unix(timestamp).format('DD.MM.YYYY');
33}
73function timestamp() {
74 return dateformat('yyyy-mm-dd HH:MM:ss (Z)')
75}

Related snippets