Sara
Sara7mo ago

Dates in database

question, how do I tell the database that I'm setting a value as a Date instead of a number?
7 Replies
Michal Srb
Michal Srb7mo ago
Data Types | Convex Developer Hub
All Convex documents are defined as Javascript objects. These objects can have
Michal Srb
Michal Srb7mo ago
The direct answer is "you can't", you'll have to know how to handle the string or numerical field in your code (which shouldn't be a problem, the main challenge is deciding what kind of dates you want to work with, as per the docs).
Sara
SaraOP7mo ago
so yep, I followed that, but I'm very interested to know how do I show it in the tables like the expiration date for instance?
No description
Michal Srb
Michal Srb7mo ago
Ah, the dashboard does this automatically if it finds a column with number values that are all in a reasonable UTC milliseconds range. In JS you can get such a value with Date.now(). (it should be explained if you hover the (?) next to the column name)
Sara
SaraOP7mo ago
fair enough yep
Sara
SaraOP7mo ago
No description
Sara
SaraOP7mo ago
Thanks!

Did you find this page helpful?