Where in code should conversions be done? client, server, business, or db?
We currently do conversions of timezones and unit of measure in our database and the performance is killing us and would like to move the logic. Where do you think the best location for this is?
Thanks
I would definitely get that code out of the DB. You want to store data all in a common set of units whenever you can. Having your time data stored for one specific locale (usually your own) is common.
I wouldn't put it in the business tier either, because then you'll run into situations where you have to do calculations using times from different locales, and you'll need them to have the same starting reference. Again, you should leave them all at a common base, and the most logical thing here is to just let that base be whatever locale you're storing them in.
I think the most logical thing to do is to have time converted to the user's locale at the last possible moment, right before you display it. This puts it firmly in the GUI layer.
Typically those are client/UI choices. but that preference can be passed to the server or the business rules.
I would do it in the client to normalize data everywhere else.
EDIT:
If you have a really thin client and do not want to add logic to it, then find the next place where you have code/rules/etc and add them there. Find the outermost/client side code and put it with that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With