Converting a parameter to unix epoch date in mongo!


I tried to look for this here on the forum and on stack overflow, but I could not find anything that would work with redash.

I am trying to query using redash parameters for date and time. My database has a timestamp parameter that is in epoch. How do I convert the date and time parameter to epoch time?

Example of a document from the db:
firstName: “Stacy”,
lastName: “Smith”,
dateCreated: {seconds:1631930899059}

I can query with dateCreated.seconds : {

But once I replace that 5000 with a parameter, it obviously doesn’t work.

Mark as closed please.

Can you share your fix?


I used an aggregate to have access to the $convert functionality and converted my Unix timestamp to a date object, then I used "$humanTime": "{{Start Date}}" to match that! Total pain to get it working, but it worked finally. Thank you guys for the amazing platform.