#community-help

Filtering by Unix Timestamps in Typesense

TLDR Nathan asked if it's possible to filter using current time in Typesense. Jason confirmed filtering requires generating and passing current unix timestamp from the client.

Powered by Struct AI

1

Jun 09, 2023 (6 months ago)
Nathan
Photo of md5-aa846ac80f1164f0d27b340467fd28e2
Nathan
08:29 PM
I'm assuming the answer is "no," based on https://typesense.org/docs/guide/tips-for-searching-common-types-of-data.html#dates-times, but I'll ask anyways. Some of my fields are unixTimestamps, and I'd love to have a preset (or normal search) with filter_by=startTimestamp:>now. Is that possible, or do I always need to pass in an actual unix timestamp to compare startTimestamp with?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
08:30 PM
The latter - you would have to generate the current unix timestamp in your client and then pass that as a numeric value to Typesense in the query

1