Handling time zone in web application

后端 未结 6 908
梦毁少年i
梦毁少年i 2020-12-24 03:45

In our web application we need to show and enter date time information for different countries in different time zone. Right now, we are maintaining separate web server and

6条回答
  •  半阙折子戏
    2020-12-24 04:26

    Here I have clarified the following specific questions.

    Q. Most of the time we are capturing date alone, is it require to capture date and time along with time zone always?

    A. Yes

    Q. while storing date and time where we need to convert user local time zone to UTC in javascript/java/oracle?

    A. Not convert during data save, save as it with source date+time+zone

    Q. While fetching date and time where we need to convert UTC to user local time zone query itself/java/java script?

    A. Always convert to display in local time zone OR UTC format where application opened.

    Q. Many place we have reports to show based on date column such as today/current month/date range.how we can handle this(input - user local time zone - database in UTC)?

    A. The system should provide setting option to user for date time display in what format, either local where application opened or UTC. All is done on front end only.

    Q. Which data type we have to use for date field (date/timestamp/timestamp with time zone/timestamp with local time zone)?

    A. Timestamp

    So in short, save datetime in source time zone and convert based upon user preferences either in local where page opened or UTC format. Means, conversion will be done through script for display only. The region where product is being popular can also be find.

提交回复
热议问题