I know you can pull the server timestamp in web, ios, and android - but what about the new Cloud Functions for Firebase? I can\'t figure out how to get the server timestamp
Using the following in the cloud function which is equivalent of Timestamp.now() on client side, this returns the current Timestamp
admin.firestore.Timestamp.now()
But if you want to initialise Timestamp from Date object you can do it as follows
admin.firestore.Timestamp.fromDate(new Date())
And if you want to to initialise Timestamp for future or past date then first intialise the Date object either from parsing string or setting time that you want to set and pass it to Timestamp.fromDate()
var date = new Date('Wednesday, October 30, 2019 09:10 PM')
//or date = new Date('2014-06-30T06:40:53+05:30')
var timestamp = admin.firestore.Timestamp.fromDate(date)