I have a 3 fields.
1. Date (as DATE)
2. Time (as TIME)
3. GMT Offset (as TIME)
I need to add the 3 fields together to retrieve a final DATETIME field in which to work with.
i) How do I do that and cope with overlapping days when the GMT offset carries the date into a new day?
ii) Is it more efficient to store the Date and Time as a single DATETIME field? And if so, what about the GMT offset? Keep it as a TIME field, or perhaps something else?
My opinion is that it is better to store the first two fields as a
DATATIME(MyDateTime) field. Then, it’s a matter of usingSELECT TIMESTAMPADD(HOUR,GMT_Offset,MyDateTime)to put it together.Of course, if you want, you could just throw it all of them into a single expression:
I am assuming that
MyDateandMyTimeare already in GMT.