new Date() // Mon Jun 01 2020 20:25:36 GMT+0800 (中国标准时间)
you can see string with timezone with
+0800 but should we store into database with timezone? i don't think so.
Database has timezone settings also os system has timezone settings too. if we database set timezone with other value after read records from db we maybe got wrong value with different timezone.
The best way store datetime to database can store absolut time value to database. absolut time if number with from 1970-01-01 00:00:00 to
now and get seconds.
Stroe absolut time in database benefit:
- we can render time string with different timezone and right value.
- we can caculation two datetime range value, got two time pass away
Also have bad side:
- we can't direct know database field datetime just can see