Skip to content
Advertisement

Tag: timestamp

How to save date as Timestamp in firestore using firebase-admin?

Trying to convert from javascript date to firestore timestamp throws I tried it in 2 ways: Using firebase-admin Using firebase.firestore: date used as a param in new Date is of this format: “2017-01-29”. Expected result: firestore timestamp. Actual result: TypeError: Cannot read property ‘Timestamp’ of undefined Note: db nor firebase are null or undefined. Is there a definitive way of

How do you get a timestamp in JavaScript?

Something similar to Unix’s timestamp, that is a single number that represents the current time and date. Either as a number or a string. Answer Short & Snazzy: A unary operator like plus triggers the valueOf method in the Date object and it returns the timestamp (without any alteration). Details: On almost all current browsers you can use Date.now() to

Advertisement