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.
3 export 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 }
13 getTimestamp (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 }
78 export function toDate(stamp: Time): Date { 79 const { sec, nsec } = stamp; 80 return new Date(sec * 1000 + nsec / 1e6); 81 }
12 toJsDate() { 13 return new Date(this._value.getTime()); // return a clone. 14 }
8 export 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 }
90 export function timeStampDate(timeStamp) { 91 92 if (typeof timeStamp === "string") { 93 return timeStamp.replace(/T.+/, ""); 94 } 95 96 return timeStamp; 97 }
200 public 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 }
182 static date(timestamp) { 183 return new Date(timestamp * 60 * 1000); 184 }
31 static getDate(timestamp: number): string { 32 return Moment.unix(timestamp).format('DD.MM.YYYY'); 33 }
73 function timestamp() { 74 return dateformat('yyyy-mm-dd HH:MM:ss (Z)') 75 }