sql - How to manage orders and time zones related issues? -


in ecommerce app,

scenario 1

assume server in ny, usa , client in tokyo, japan. client makes order , needs delivered in 10 days. in scenario there 2 times zones ny, usa , tokyo, japan , there 10-day promise.

  1. when client makes order how many time zone details entered database?
  2. i told colleague have consider utc how fits in this?
  3. when calculate 10 days, based on time zone 10 days needs calculated?
  4. could 1 give me link shows how handled?

to reasonably sane implementation, should store dates utc. linear time independent of time zones , daylight savings time.

when read time database , display user, should convert local time zone. in .net can use timezoneinfo object convert date specific time zone.

when client makes order how many time zone details entered database?

you need store utc time in database. exact point in time, can later convert local time.

when calculate 10 days, based on time zone 10 days needs calculated?

that depends on how 10 days defined. can add 10 days utc time, , point in time 240 hours later. means may in practice have 9 days make delivery, depending on when order placed, , times of day can make delivery.

those ten days defined calendar days, entire tenth day included, e.g. if user places order @ 2015-07-02 03:26, should arrive before 2015-07-12 23:59 in time zone.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -