Replies: 3 comments 2 replies
-
The main benefit of storing date times as text is that we get to know about a time zone offset, if there is any. For that, we use the
May I ask why? If it's purely for consistency, having
This expression is run by the database, it's not possible to run it in Dart alone without adding it to a SQL statement and executing it.
This is not possible with the builtin date-time type. You could store them as a text column and apply a type converter only using the format you prefer.
You can also use |
Beta Was this translation helpful? Give feedback.
-
My first important principle let me drive is that I need to be conform and ISO in all context of my app with DateTime for all the users into the world. Thus, I follow your recommandations for using this UTC expressions of DateTime : For that I define my mixins like that :
And use the same way to define my DateTime into my companion class : I confirm that is more simple because when I retrieve DateTime to string I can again convert it like that : Thank you for your help and your recommandations Simolus3 👍 |
Beta Was this translation helpful? Give feedback.
-
Datetime Thank you for your advice. I changed my declaration into my mixins like that : UpdateAt You are right ! I already be aware of that (without find solution). My updatedAt field run correctly ONLY if I explicity specified into my companion object otherwise it will not update. It can be boring for me to always specified this field manually. But for now I don't know how automatically filled this field. |
Beta Was this translation helpful? Give feedback.
-
In context of application that work with entities and logged creation or modification data, I have this 2 fields in each of my entities :
I work with this parameter database drift :
store_date_time_values_as_text: true
to avoid of declaring this fields in each entities I have created a Mixin like that :
AND when I persist data without explicity fill this 2 fields, Drift persist this field like this format :
2023-11-06 15:39:23
NOW if I need to update an entity, I need to use update statement with entity fields filled like this :
the result into database is :
2023-11-06T16:24:28.374052Z
I would like to have this format :
2023-11-06 15:39:23
everywhere and everytime in my database.But I don't understand :
const currentDateAndTime
?Thank you for everyone that can help me...
Beta Was this translation helpful? Give feedback.
All reactions