I am trying to develop an app and there is a Transaction table. In this table, there will be also a date & time field.
In order to keep the transaction time precisely, I think of using java.time.Instant
. And whenever I need to convert this to any time zone, I can do it easily and for this reason there will be no problem regarding to time zone. With this approach, I can keep transaction time as a timestamp + solve time zone problem. Is that a true approach?
The second issue id that, do I need to keep another variable for displaying the transaction time properly? Or, is it ok to keep the time as timestamp (java.time.Instant
) and display by formatting it when needed. What would you suggest?