|
| [wm20-android] UTC vs localtime in database ? |
| Iniciado por guest, 17,nov. 2015 05:16 - No hay respuesta |
| |
| | | |
|
| |
| Publicado el 17,noviembre 2015 - 05:16 |
I wonder if using UTC in database is good idea compare to localtime ?
currently i working on andrroid app which will use mysql database and sqlite .
i found that on mysql internally store datetime in UTC but present in localtime . when I run "select now();" will return local time and table with field default CURRENT_timestamp(6) will show localtime
but on sqlite , the 'now' will return UTC . this cause table with field default current_timestamp will show UTC .
in order to not cause confuse in long run , I decide to change the mysql default timezone to UTC .
but there's one problem show up . because mysql and sqlite now both UTC which mean every time i store/ retrieve datetime , I must do convert using DateTimeLocalToUTC() / DateTimeUTCToLocal() . which i feel more work to do
is there a better solution ? , any suggestion ? |
| |
| |
| | | |
|
| | | | |
| | |
|