0

How would I convert the following dateformat 2020-09-18T18:36:15.000Z to Timestamp using the firebase-admin npm package

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Coder3000
  • 119
  • 2
  • 7

1 Answers1

1

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.

PRSHL
  • 1,359
  • 1
  • 11
  • 30