I am working on buy order table for store client's record from frontend side and my case:
Client would which come from different countries, different timezones
My database server timezone is on UTC+1
Daylight saving time might apply in some countries
Some clients might buy a product from country A, then buy another product from country B the next day but on different timezones
Some client (travelers) which come from country A (UTC+2) and bought items in country B (UTC+0) via his phone (UTC+3, I don't know why but they are)
Here are my questions:
What is the best practice to store the datetime in the database?
Does frontend side need to convert timezones from client to database?
Does backend side need to convert timezones from database to client? How do I determine a client's current timezone?
What is the best practice to show datetime from server to website for client review?
(New) How do I handle available_delivery_date and available_delivery_time which those fields input by client?
==================
[ Update 1 ]
An addition description about question point 5, my order table have 2 fields named available_delivery_date and available_delivery_time which input by client with their timezone, what is the best practice to save the record?
Everything is depending on future use cases and your requirement. No format is standard whatever works best for you.
What is the best practice to store the datetime in the database?
-If you need to perform calculation like days from purchase using date store it in either datetime or timestamp. Storing as varchar and parsing before calculation also can be done.
Does frontend side need to convert timezones from client to database?
-Make backend use one standard time format and on response pass date from server date and time so that your time would be standard for all users.
Does backend side need to convert timezones from database to client? How do I determine a client's current timezone?
-Use servers date and time to standarize your time formats.
What is the best practice to show datetime from server to website for client review?
-Best practice is to use backend to insert server time on insert query so that server time would be standard for all users. You can fetch the row and pass it to frontend which is based on server time
Related
I want to create a database that has a table of client information, and a second table with information about interactions with that client on a specific date.
So I've created ClientTable, and AppointmentTable, with a lookup on AppointmentTable to link to the client data. The database functions, and using a query form, I can make appointment notes and update client information.
But I need to have a simple interface, so I can specify a date, search for a client, and create a new record on AppointmentTable with the date and client already set.
I'm struggling to know if I am supposed to do this on a query form, or on the form for AppointmentTable. It's been decades since I've used Access and I'm pretty rusty. I don't need anything fancy, and I'd prefer to avoid VBA, as this seems like it should be a straight forward database feature.
I have a situation where I have to save UK citizen data to UK server and US citizen data to US server.
Customer (citizen) will fill a form in a web application, telling which country citizen he/she is. The storage is then chosen by a web application.
Is it possible to achieve something like this, or not?
And there also must be a possibility to query all citizens from both storages at once.
What you need is called zone sharding in MongoDB. Essentially, given a shard key, you can tell MongoDB to store certain range of keys in certain part of the sharded cluster.
There is an example in Segmenting Data by Location which describes your use case.
Having said that, if you don't need to query all citizens very frequently, it's likely to be easier to deploy separate deployments under each jurisdiction, and perform the same query on each of them. This way, if you need the US servers to be maintained, it won't affect the UK operation.
From high level usage, please help me with the following.
I am looking to utilize the database from Expedia EAN. It recommends you update the database weekly via cron job.
On the home page of my application, if I have a enter your location/dates/number of guests, and search for hotel availability, should I be fetching data via this local database or from via the live API?
It doesn't seem to make sense to fetch this from the local database, as how will it be up to date in terms of use availability. If that's the case, it doesn't really seem useful to use the local database unless its just for browsing hotels?
Thanks
Expedia's EAN provides the Database with pseudo-static (slowly changing) data such as hotel's location, address, images, description etc. These are the ones to be downloaded as files once per day or so.
Then they also provide dynamic data such as availability and prices via their API. Those data surely can be fetched at the time of request.
Suppose that on your ProjectBus you created an entity class name is Person
and here is our function does ;
Person p=new Person(){Name=Dummy Smith,LastLoginDate=DateTime.Now,....};
personEntityService.Persons.Add(p);
personEntityService.SubmitChanges();
I think we trust the datetime on client side,because we got client date.
If an operation is financial or pathologically important,client can fraud us. Or we may cause client's loss.
So I'm asking for best practices.
One solution we applied is getting server datetime and looking diffrence between server and client during login process.(or before any transaction on your transaction bridge) If the datetime diffrence is not applicable reject operation and throw your date is wrong!
Or we may do not use DateTime funcs. on client code ,they will be filled in server side.
For this scenario we need to use db default fields or(and) we manage domain service class's submit ops.etc.
So what is formal,most choosen way of managing date fields in Silverlight Rich Internet Apps.
Any comment will be appreciated.
How is this problem generally solved?
To give some context, I have a single database and multiple processes connected to that database (a mobile api, a custom content management tool and a custom front end website), they all run on different servers. Sometimes it is useful to get delta changes on the database; for instance say I update the database with new data using the content management tool (which then sets some metadata on the data that was changed, specifically its updated_at field), and all my mobile apps need a local copy of the database to work. It wouldn't make much sense to redownload the whole db, so it's useful for the app to send its local last_updated timestamp and retrieve the subset of fields which were updated since that time. But the mobile api's server's last_updated and the database server's updated_at are not calculated from the same time source, each server has its own clock.
Is using a time based "freshness indicator" just a dirty mess or is there a robust and efficient way to do it? Or is there a better approach? I'm thinking something like incrementing a version number. What's the best practice for this kind of thing?