How would I convert the following dateformat 2020-09-18T18:36:15.000Z
to Timestamp using the firebase-admin npm package
CodePudding user response:
You can just use the fromDate
function like this:
import * as admin from 'firebase-admin';
const str = "2020-09-18T18:36:15.000Z";
const timestamp = admin.firestore.Timestamp.fromDate(new Date(str))
Check the documentation for further readings here.