-
Notifications
You must be signed in to change notification settings - Fork 17
Date, Day and Time Convention
Abel Mathew edited this page Feb 4, 2021
·
3 revisions
Our project is using date, time and day in multiple places. To maintain uniformity on the back-end and later understanding, we are following the below conventions.
Sample String: 2019-08-05T02:50:49.637Z
- Store in the database as DateTime type. The timezone by default is UTC, and we store in that.
- Timezone if needed can either be processed on API code or on client-side as per the case.
- Store in the database as DateTime type. The date part will be any random date.
- Discard the date information from the data while processing on client-side preferably.
- Timezone if needed can either be processed on API code or on client-side as per the case.
- Use the following convention for schema
{
day:{
type: Number,
max: 6,
min: 0,
}
}
- In the database, it will be
day: Number
Example
day: 1
This would mean the day is Monday
0 corresponds to Sunday and 6 to Saturday.
NOTE : Storing in UTC timezone may require time conversion, check the case and do it to make sure data is stored in UTC timezone