Firebase query based on Timestamp

I would like to create a query of database filter by timestamp - e.g. From start at 365 days ago and end at Now. How to convert regular date to firebase timestamp format (UNIX Epoch?) for the query?

using System; has a DateTimeOffset class that can convert to and from unix time in milliseconds. Here is an example of Now and 365 days ago converted to milliseconds since 01/01/1970:

var now = DateTimeOffset.Now.ToUnixTimeMilliseconds();
var lastyear = DateTimeOffset.Now.Subtract(new TimeSpan(365, 0, 0, 0)).ToUnixTimeMilliseconds();