Reputation: 341
i am getting the data like this October 17, 2017 at 5:47:37 PM UTC+5:30 Now, how can i convert it to timestamp like 55773**998 ?
Upvotes: 2
Views: 3253
Reputation: 968
First, you need to import the Firebase Admin:
const admin = require('firebase-admin');
Then save the Firestore timestamp:
const timestamp = admin.firestore.FieldValue.serverTimestamp();
Upvotes: 3
Reputation: 36703
You can remove at
and then convert it to new date.
var date = " October 17, 2017 at 5:47:37 PM UTC+5:30";
var parsedDate = new Date(date.replace(/at/g, "")).getTime();
console.log(parsedDate);
Upvotes: 3