CN110716781A - Multi-time zone time display method, configuration method and device - Google Patents
Multi-time zone time display method, configuration method and device Download PDFInfo
- Publication number
- CN110716781A CN110716781A CN201910927893.7A CN201910927893A CN110716781A CN 110716781 A CN110716781 A CN 110716781A CN 201910927893 A CN201910927893 A CN 201910927893A CN 110716781 A CN110716781 A CN 110716781A
- Authority
- CN
- China
- Prior art keywords
- time
- background
- time zone
- zone
- offset
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Electric Clocks (AREA)
Abstract
The embodiment of the invention discloses a multi-time-zone time display method, a multi-time-zone time configuration method and a multi-time-zone time display device, relates to the technical field of computers, and can greatly simplify the multi-time-zone time display operation and the multi-time-zone time configuration operation and effectively improve the efficiency and the accuracy of the multi-time-zone time display and configuration. The display method comprises the following steps: reading a third duration parameter corresponding to the time item to be displayed from a preset database; determining a background time zone on which the showing operation of the time item is based, wherein the background time zone is one of 24 geographic time zones around the world; adjusting the third time length parameter according to the background offset of the background time zone relative to the middle time zone and the system offset of the current system time zone relative to the middle time zone to obtain a fourth time length parameter; and displaying the time item as the time reached after the time length corresponding to the fourth time length parameter is passed on the basis of the preset reference time. The invention is suitable for application scenes of various time zone conversion.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a multi-time-zone time display method, a multi-time-zone time configuration method and a multi-time-zone time configuration device.
Background
In an internationalized multi-time-zone APP application management background, internationalized time zone problems such as date and time are generally required to be handled. For example, the operator configures an activity item in the united states in the management background located in china, and the activity start/end time set by the date and time selection control is the system time (i.e., the china district time) obtained from the browser or the client, whereas the united states time may actually need to be set.
Since time zones of different countries/regions are different, time allocation in the management background is based on system time, and thus the time displayed in different countries/regions by the management background may be different (for example, us time is displayed in the united states, and chinese time is displayed in china), so that in multi-time allocation (for example, time allocation performed by multiple operators in different countries/regions, or time allocation performed by one operator in multiple time zones in a fixed country/region) is very easy to be confused, and a series of time errors and compatibility problems may be caused if the time allocation is not properly processed.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, a device and a system for displaying and configuring time in multiple time zones, which can greatly simplify the time display operation and the configuration operation in multiple time zones, and effectively improve the efficiency and accuracy of the time display and configuration in multiple time zones.
In a first aspect, an embodiment of the present invention further provides a method for displaying time in multiple time zones, including: reading a third duration parameter corresponding to the time item to be displayed from a preset database; determining a background time zone on which the showing operation of the time item is based, wherein the background time zone is one of 24 geographic time zones around the world; adjusting the third time length parameter according to the background offset of the background time zone relative to the middle time zone and the system offset of the current system time zone relative to the middle time zone to obtain a fourth time length parameter; wherein the middle time zone is a time zone in which the first meridian is located among the 24 geographic time zones; and displaying the time item as the time reached after the time length corresponding to the fourth time length parameter is passed on the basis of the preset reference time.
Optionally, the adjusting the third duration parameter according to the background offset of the background time zone relative to the middle time zone and the system offset of the current system time zone relative to the middle time zone to obtain a fourth duration parameter includes: the fourth duration parameter is equal to the third duration parameter plus a difference between the background offset and the system offset.
Optionally, the displaying the time item is performed after a time that is reached after a time corresponding to the fourth time parameter passes by based on a preset reference time, and the method further includes: and carrying out time zone switching display on the displayed time items.
Optionally, the displaying the displayed time item by time zone switching includes: acquiring an original time length parameter corresponding to a time item of an original background time zone; determining an original background offset of the original background time zone relative to the middle time zone and a new background offset of a new background time zone relative to the middle time zone; determining that the switched new duration parameter is equal to the original duration parameter plus the offset difference between the new background offset and the original background offset; and displaying the time which is reached after the time length corresponding to the new time length parameter is passed based on the preset reference time in the new background time zone.
Optionally, the displaying the displayed time item by time zone switching includes: acquiring an original time length parameter corresponding to a time item of an original background time zone; converting the original time length parameter into a system time length parameter corresponding to the current system time zone according to the original background offset of the original background time zone relative to the middle time zone and the system offset of the current system time zone relative to the middle time zone; converting the system time length parameter into a new time length parameter corresponding to the new background time zone according to the new background offset of the new background time zone relative to the middle time zone and the system offset; and displaying the time which is reached after the time length corresponding to the new time length parameter is passed based on the preset reference time in the new background time zone.
In a second aspect, an embodiment of the present invention provides a method for configuring time in multiple time zones, including: determining a background time zone for which configuration operation is directed, wherein the background time zone is one of 24 geographic time zones around the world; converting a target configuration time input by a user into a first time length parameter, wherein the first time length parameter is equal to the time difference between the target configuration time and a preset reference time; adjusting the first duration parameter according to the background offset of the background time zone relative to the middle time zone to obtain a second duration parameter corresponding to the target configuration moment, and storing the second duration parameter into a database; wherein, the middle time zone is the time zone of the first meridian in the 24 geographic time zones.
Optionally, the adjusting the first duration parameter according to the background offset of the background time zone relative to the middle time zone to obtain the second duration parameter corresponding to the target configuration time includes: determining the background offset of the background time zone relative to the middle time zone according to the relative relationship between the time zones; and determining the second time length parameter according to the first time length parameter and the background offset, wherein the second time length parameter is equal to the sum of the first time length parameter and the background offset.
In a third aspect, an embodiment of the present invention further provides a time display apparatus for multiple time zones, including: the reading unit is used for reading a third duration parameter corresponding to the time item to be displayed from a preset database; a second determining unit, configured to determine a background time zone on which the displaying operation of the time item is based, where the background time zone is one of 24 geographic time zones around the world; a second adjusting unit, configured to adjust the third duration parameter according to a background offset of the background time zone relative to a middle time zone and a system offset of a current system time zone relative to the middle time zone, so as to obtain a fourth duration parameter; wherein the middle time zone is a time zone in which the first meridian is located among the 24 geographic time zones; and the display unit is used for displaying the time item as the time which is reached after the time length corresponding to the fourth time length parameter is passed on the basis of the preset reference time.
Optionally, the second adjusting unit is specifically configured to adjust the third duration parameter to a fourth duration parameter, where the fourth duration parameter is equal to the third duration parameter plus a difference between the background offset and the offset of the system offset.
Optionally, the time display apparatus further includes a switching unit, configured to perform time zone switching display on the displayed time item after the time item reaches a time after a time corresponding to the fourth time parameter passes based on a preset reference time.
Optionally, the switching unit includes: the first acquisition module is used for acquiring an original time length parameter corresponding to a time item of an original background time zone; a first determining module, configured to determine an original background offset of the original background time zone relative to the middle time zone and a new background offset of a new background time zone relative to the middle time zone; the second determining module is used for determining that the switched new time length parameter is equal to the original time length parameter plus the offset difference between the new background offset and the original background offset; and the first display module is used for displaying the time which is reached after the time length corresponding to the new time length parameter passes by on the basis of the preset reference time in the new background time zone.
Optionally, the switching unit includes: the second acquisition module is used for acquiring the original time length parameter corresponding to the time item of the original background time zone; a first conversion module, configured to convert the original time length parameter into a system time length parameter corresponding to the current system time zone according to an original background offset of the original background time zone with respect to the middle time zone and a system offset of the current system time zone with respect to the middle time zone; the second conversion module is used for converting the system time length parameter into a new time length parameter corresponding to a new background time zone according to a new background offset of the new background time zone relative to the middle time zone and the system offset; and the second display module is used for displaying the time which is reached after the time length corresponding to the new time length parameter passes by on the basis of the preset reference time in the new background time zone.
In a fourth aspect, an embodiment of the present invention further provides a time configuration apparatus for multiple time zones, including: a first determining unit, configured to determine a background time zone for which a configuration operation is performed, where the background time zone is one of 24 geographic time zones around the world; the conversion unit is used for converting a target configuration time input by a user into a first time length parameter, wherein the first time length parameter is equal to the time difference between the target configuration time and a preset reference time; the first adjusting unit is used for adjusting the first duration parameter according to the background offset of the background time zone relative to the middle time zone to obtain a second duration parameter corresponding to the target configuration time, and storing the second duration parameter into a database; wherein, the middle time zone is the time zone of the first meridian in the 24 geographic time zones.
Optionally, the first adjusting unit is specifically configured to: determining the background offset of the background time zone relative to the middle time zone according to the relative relationship between the time zones; and determining the second time length parameter according to the first time length parameter and the background offset, wherein the second time length parameter is equal to the sum of the first time length parameter and the background offset.
In a fifth aspect, an embodiment of the present invention further provides an electronic device, including: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space enclosed by the shell, and the processor and the memory are arranged on the circuit board; a power supply circuit for supplying power to each circuit or device of the electronic apparatus; the memory is used for storing executable program codes; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, and is used for executing any one of the time configuration methods of the multiple time zones or any one of the time display methods of the multiple time zones provided by the embodiment of the invention.
In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where one or more programs are stored, and the one or more programs are executable by one or more processors to implement any one of the methods for configuring time in multiple time zones or any one of the methods for displaying time in multiple time zones provided by the embodiments of the present invention.
According to the multi-time-zone time display method, the multi-time-zone time configuration method and the multi-time-zone time display and configuration device, the management mechanism of the background time zone is established, the user does not need to convert various complex time zones when displaying and configuring the time, and the time of the time zone can be accurately displayed and configured only by selecting the corresponding background time zone, so that the time display operation and the configuration operation of the multi-time zone are greatly simplified, and the efficiency and the accuracy of the multi-time-zone time display and configuration are effectively improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flow chart of a method for displaying time in multiple time zones according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating an effect of background time zone switching according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating an effect of background time zone switching according to an embodiment of the present invention;
FIG. 4 is a detailed flowchart of a method for displaying time in multiple time zones according to an embodiment of the present invention;
FIG. 5 is a flowchart of a method for configuring time in multiple time zones according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating an effect of background time zone selection according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating another effect of background time zone selection according to an embodiment of the invention;
FIG. 8 is a diagram illustrating another effect of background time zone selection according to an embodiment of the present invention;
FIG. 9 is a detailed flowchart of a time allocation method for multiple time zones according to an embodiment of the present invention;
FIG. 10 is a schematic structural diagram of a multi-time zone time display apparatus according to an embodiment of the present invention;
FIG. 11 is a schematic structural diagram of a time allocation apparatus for multiple time zones according to an embodiment of the present invention;
fig. 12 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In a first aspect, an embodiment of the present invention further provides a multi-time-zone time display method, which can greatly simplify the multi-time-zone time display operation, and effectively improve the multi-time-zone time display efficiency and accuracy.
As shown in fig. 1, an embodiment of the present invention provides a method for displaying time in multiple time zones, which may include:
s11, reading a third duration parameter corresponding to the time item to be displayed from a preset database;
in the embodiment of the present invention, the preset database may record a third duration parameter (i.e., a time interval between the time to be displayed and a preset reference time) corresponding to the time item to be displayed. Optionally, the preset database may be a database into which data configured according to the multi-time zone time configuration method provided by the embodiment of the present invention is stored, or may be a database provided by a third party, which is not limited in the embodiment of the present invention.
S12, determining a background time zone on which the display operation of the time item is based, wherein the background time zone is one of 24 global geographic time zones;
it is understood that the user may have his own time reference system when viewing information such as the event time, for example, in the united states, the user may refer to the time in the west 5 zone, and if the user wants to view the event time corresponding to a few points of the beijing time, the user may refer to the time in the east 8 zone. In order to determine the time reference system of the user, in this step, the background time zone on which the display operation of the time item is based may be determined according to the selection of the user, for example, the user may select time zones such as the east 1 zone, the west 3 zone, and the like as the background time zone.
S13, adjusting the third time length parameter according to the background offset of the background time zone relative to the middle time zone and the system offset of the current system time zone relative to the middle time zone to obtain a fourth time length parameter; wherein the middle time zone is a time zone in which the first meridian is located among the 24 geographic time zones;
in this step, the system time zone of the current computer system may be obtained, the system offset of the system time zone relative to the middle time zone may be calculated, and the third duration parameter may be adjusted by using the system offset and the background offset of the background time zone relative to the middle time zone to obtain the fourth duration parameter, so that the third duration parameter read from the database may be converted into the fourth duration parameter with the background time zone as a reference.
And S14, displaying the time item as the time reached after the time length corresponding to the fourth time length parameter is passed on the basis of the preset reference time.
Since the fourth time parameter is a relative value and the time that the user wants to show is a specific time, in order to facilitate the user to view the time, in this step, the time item to be shown can be determined according to the inverse operation of the calculation method of the time parameter. For example, in an embodiment of the present invention, the duration parameter is based on 1/1970 (00:00:00GMT (GreenwichMean Time, greenwich mean Time)), and then a fourth duration parameter is added to the Time, so that the obtained Time is the specific Time corresponding to the Time item to be displayed.
The multi-time-zone time display method provided in the embodiments of the present invention can read a third duration parameter corresponding to a time item to be displayed from a preset database, determine a background time zone on which a display operation of the time item is based, adjust the third duration parameter according to a background offset of the background time zone with respect to a middle time zone and a system offset of a current system time zone with respect to the middle time zone, to obtain a fourth duration parameter, and display the time item as a time that arrives after a duration corresponding to the fourth duration parameter passes based on a preset reference time. Therefore, the background time zone corresponding to the display operation is set, the third time length parameter read from the database is adjusted according to the background offset and the system offset to obtain the fourth time length parameter, and the time length parameter stored in the database can be converted into the time zone corresponding to the display operation without complex time zone conversion, so that the time display operation of multiple time zones is greatly simplified, and the time display efficiency and accuracy of the multiple time zones are effectively improved.
Optionally, in step S13, adjusting the third duration parameter according to the background offset of the background time zone relative to the middle time zone and the system offset of the current system time zone relative to the middle time zone, and obtaining a fourth duration parameter may include:
determining that the fourth duration parameter is equal to the third duration parameter plus a difference between the background offset and the system offset.
For example, in one embodiment of the present invention, the background time zone is the east 8 zone, the system time zone is the middle time zone, the third duration parameter read from the database is 1566446400, the background offset is 8-0 ═ 8 hours, the system offset is 0-0 ═ 0, and the fourth duration parameter is 1566446400+ (8-0) × 60 ═ 1566475200.
Furthermore, in an embodiment of the present invention, after the time item read from the database is displayed, different background time zones can be switched to further display the time item, so that the user can conveniently query and compare multiple time zones. Specifically, in step S14, the time item is displayed as a time that is reached after the time corresponding to the fourth time parameter passes based on a preset reference time, and the method for displaying time in multiple time zones according to the embodiment of the present invention may further include: and carrying out time zone switching display on the displayed time items. The effect diagrams of the background time zone switching can be as shown in fig. 2 and fig. 3.
Optionally, when the time zone is switched and displayed, the time zone switching operation may be directly switched from the original background time zone to the new background time zone, or the original background time zone may be first converted into the system time zone and then the system time zone may be converted into the new background time zone by using the system time zone as a transition. The following is illustrated by two examples, respectively.
Specifically, in an embodiment of the present invention, displaying the time zone switch of the presented time item may include:
acquiring an original time length parameter corresponding to a time item of an original background time zone;
determining an original background offset of the original background time zone relative to the middle time zone and a new background offset of a new background time zone relative to the middle time zone;
determining that the switched new duration parameter is equal to the original duration parameter plus the offset difference between the new background offset and the original background offset;
and displaying the time which is reached after the time length corresponding to the new time length parameter is passed based on the preset reference time in the new background time zone.
For example, in an embodiment of the present invention, the original background time zone is a time zone in tokyo (east 9 zone), the time corresponding to the original background timestamp is tokyo time 9, and the new background time zone is a time zone in london (middle time zone). The handover results are as follows:
new duration parameter + (0-9) × 60 ═ original duration parameter-32400
And displaying the time which is reached after the time length corresponding to the new time length parameter is passed on the basis of the preset reference time.
Optionally, in an embodiment of the present invention, the displaying the displayed time item by time zone switching may include:
acquiring an original time length parameter corresponding to a time item of an original background time zone;
converting the original time length parameter into a system time length parameter corresponding to the current system time zone according to the original background offset of the original background time zone relative to the middle time zone and the system offset of the current system time zone relative to the middle time zone;
converting the system time length parameter into a new time length parameter corresponding to the new background time zone according to the new background offset of the new background time zone relative to the middle time zone and the system offset;
and displaying the time which is reached after the time length corresponding to the new time length parameter is passed based on the preset reference time in the new background time zone.
For convenience of understanding, the present embodiment is described by taking the specific time of the time item as an example, rather than taking the time duration parameter as an example.
In an embodiment of the present invention, the original background time zone is a time zone (east 9 zone) in which tokyo is located, the time corresponding to the original background timestamp is tokyo time 9, the system performing the time item display operation is located in beijing, the system time is beijing time (east 8 zone), and the new background time zone is a time zone (middle time zone) in which london is located. The handover procedure is as follows:
firstly, switching an original background time zone of a timestamp to a system time zone (switching an east 9 zone to an east 8 zone), and converting corresponding time into 9 o- (9-8) hours which are 8 o' clock;
the timestamp after switching to the system time zone is converted to london time (east 8 zone switching to the central zone): 8 points- (8-0) hour is 0 point.
That is, if the start time of the original activity is 9 tokyo time, the start time of the activity is london time 0 in the new background time zone after the background time zone is switched.
The following describes in detail a time display method for multiple time zones according to an embodiment of the present invention with specific embodiments.
As shown in fig. 4, a method for displaying time in multiple time zones according to an embodiment of the present invention may include:
s701, determining a new background time zone to be switched to;
s702, reading a third duration parameter in the database;
s703, converting the third time length parameter into a system time length parameter of the current computer system;
s704, respectively determining a new background offset of the new background time zone relative to the middle time zone and a system offset of the system time zone of the current computer system relative to the middle time zone;
s705, correcting the system time length parameter by using the difference between the new background offset and the system offset to form a fourth time length parameter;
s706, generating a corresponding time character string by the fourth time parameter;
and S707, updating all time display of the configuration interface by using the generated time character string.
In a second aspect, an embodiment of the present invention provides a time allocation method for multiple time zones, which can simplify time allocation operations for multiple time zones, and effectively improve efficiency and accuracy of time allocation for multiple time zones.
As shown in fig. 5, a method for configuring time in multiple time zones according to an embodiment of the present invention includes:
s21, determining a background time zone for the configuration operation, wherein the background time zone is one of 24 global geographic time zones;
in this step, the background time zone to which the current operation is directed may be determined according to a selection of the user, or the background time zone to which the configuration operation is directed may be determined according to a pre-configured parameter or file. For example, if a user wants to configure an activity of new york and needs to input each time node in the activity, the user may select the background time zone as the geographical time zone (west five zones) where new york is located, or may write the time zone where new york is located in a configuration file in advance, and determine that the background time zone is west five zones by reading the configuration file. An interface schematic for determining a background time zone can be seen in fig. 6, 7 and 8.
In embodiments of the present invention, after the background time zone is determined, all background operations are based on the background time zone, regardless of other system time zones, server time zones, local time zones, and the like.
Alternatively, the background time zone may be any one of 24 geographical time zones around the world, which the user may specifically select according to the needs of the configuration operation.
S22, converting a target configuration time input by a user into a first time length parameter, wherein the first time length parameter is equal to the time difference between the target configuration time and a preset reference time;
the target configuration time may be each time node that the user needs to configure, such as a start time, a rest time, an end time, and the like of the activity. In an embodiment of the present invention, a front-end device, such as a browser or a client, may provide a time input option or a time selection control for a user to receive a target configuration time input by the user, for example, the target configuration time input by the user may be received by the client, which is 2019, 9, 18, and 14: 30: 00.
specifically, the target configuration time is convenient for the user to view, but is inconvenient for the user to calculate, and for this reason, in an embodiment of the present invention, the target configuration time may be converted into a first duration parameter, that is, a time difference between the target configuration time and a preset reference time, where the time difference is a duration elapsed from the preset reference time as a starting point to the target configuration time.
Optionally, the preset reference time may be any past historical time, which is not limited in the embodiment of the present invention. In view of the versatility and convenience of the multi-Time zone Time setting, in one embodiment of the present invention, the preset reference Time may be determined as a reference Time in the definition of "timestamp" in the international standard, i.e., 1 month 1 day 1970 (00:00:00GMT (Greenwich Mean Time, Greenwich Mean Time)). Based on the reference time, the target configuration time input by the user may be converted into how many seconds are spent from the reference time, for example, the first time parameter (i.e., standard timestamp) corresponding to beijing time 2019-08-2518: 02:15 is 1566727335.
S23, adjusting the first duration parameter according to the background offset of the background time zone relative to the middle time zone to obtain a second duration parameter corresponding to the target configuration time, and storing the second duration parameter into a database; wherein, the middle time zone is the time zone of the first meridian in the 24 geographic time zones.
It should be noted that the first duration parameter itself does not have a time zone attribute, and in this step, the first duration parameter may be adjusted according to an offset of the background time zone relative to the middle time zone to obtain a second duration parameter, where the second duration parameter has a time zone attribute. In one embodiment of the present invention, the second duration parameter may be stored in a database as a time basis for subsequent queries and invocations.
It should be noted that, in the embodiment of the present invention, the offset of the background time zone with respect to the middle time zone is divided into positive and negative parts, where the offsets of the east 1 area to the east 12 area with respect to the middle time zone are positive, and the offsets of the west 1 area to the west 11 area with respect to the middle time zone are negative.
The time configuration method for multiple time zones provided in the embodiments of the present invention can determine a time zone for which a configuration operation is performed as a background time zone, convert a target configuration time input by a user into a first time length parameter, adjust the first time length parameter according to a background offset of the background time zone relative to a middle time zone, obtain a second time length parameter corresponding to the target configuration time, and directly store the second time length parameter in a database. Therefore, by establishing a management mechanism of the background time zone, a user does not need various complicated time zone conversions when configuring the time, and can realize the accurate configuration of the time zone only by selecting the corresponding background time zone, thereby greatly simplifying the time configuration operation of multiple time zones and effectively improving the efficiency and the accuracy of the time configuration of the multiple time zones.
Optionally, in step S23, the adjusting the first duration parameter according to the background offset of the background time zone relative to the middle time zone to obtain the second duration parameter corresponding to the target configuration time may specifically include:
determining the background offset of the background time zone relative to the middle time zone according to the relative relationship between the time zones;
and determining the second time length parameter according to the first time length parameter and the background offset, wherein the second time length parameter is equal to the sum of the first time length parameter and the background offset.
For example, in one embodiment of the present invention, the user needs to configure a start time of an activity in tokyo to be 2019-08-2212: 00:00, corresponding to a first duration parameter of 1566417600. If the selected background time zone is the east 9 zone, the background offset of the east 9 zone relative to the middle time zone is determined to be 9-0 to 9 (hours) according to the relative relationship between time zones and time (for example, according to a calculation formula or by querying an international time zone conversion table), and the background offset converted into the unit of seconds is 9 to 60 to 34200. The second duration parameter is 1566417600+34200 ═ 1566451800. Optionally, in another embodiment of the present invention, if the selected background time zone is the west 9 zone, the second duration parameter is 1566417600-.
By the scheme, no matter where the user is, and where the activity time needs to be configured, complicated time zone calculation and conversion are not needed, and only the background time zone corresponding to the configuration operation needs to be selected, so that the time configuration operation of multiple time zones is greatly simplified, and the time configuration efficiency and accuracy of the multiple time zones are effectively improved.
The following describes in detail a time allocation method for multiple time zones according to an embodiment of the present invention with reference to specific embodiments.
As shown in fig. 9, a method for configuring time in multiple time zones according to an embodiment of the present invention may include:
s601, acquiring a multi-time zone configuration requirement;
s602, setting a background time zone according to configuration requirements, and determining a background offset of the background time zone relative to a middle time zone;
s603, receiving target configuration time such as date and time input by a user in the background time zone;
s604, generating a target time character string from the received target configuration time;
s605, converting the time character string into a first time length parameter (such as a standard time stamp);
s606, converting the first duration parameter into a second duration parameter according to the background offset;
and S607, storing the second time length parameter into a database.
In a third aspect, an embodiment of the present invention further provides a multi-time-zone time display apparatus, which can greatly simplify the multi-time-zone time display operation, and effectively improve the multi-time-zone time display efficiency and accuracy.
As shown in fig. 10, the apparatus for displaying time in multiple time zones according to the embodiment of the present invention may include:
the reading unit 31 is configured to read a third duration parameter corresponding to a time item to be displayed from a preset database;
a second determining unit 32, configured to determine a background time zone on which the displaying operation of the time item is based, where the background time zone is one of 24 geographic time zones around the world;
a second adjusting unit 33, configured to adjust the third duration parameter according to a background offset of the background time zone relative to a middle time zone and a system offset of the current system time zone relative to the middle time zone, so as to obtain a fourth duration parameter; wherein the middle time zone is a time zone in which the first meridian is located among the 24 geographic time zones;
and the display unit 34 is configured to display the time item as a time that is reached after a time length corresponding to the fourth time length parameter passes based on a preset reference time.
The multi-time-zone time display device provided in the embodiment of the present invention can read a third duration parameter corresponding to a time item to be displayed from a preset database, determine a background time zone on which a display operation of the time item is based, adjust the third duration parameter according to a background offset of the background time zone relative to a middle time zone and a system offset of a current system time zone relative to the middle time zone, to obtain a fourth duration parameter, and display the time item as a time that arrives after a duration corresponding to the fourth duration parameter passes based on a preset reference time. Therefore, the background time zone corresponding to the display operation is set, the third time length parameter read from the database is adjusted according to the background offset and the system offset to obtain the fourth time length parameter, and the time length parameter stored in the database can be converted into the time zone corresponding to the display operation without complex time zone conversion, so that the time display operation of multiple time zones is greatly simplified, and the time display efficiency and accuracy of the multiple time zones are effectively improved.
Optionally, the second adjusting unit 33 is specifically configured to adjust the third duration parameter to be the fourth duration parameter, where the fourth duration parameter is equal to the difference between the third duration parameter plus the offset of the background offset and the offset of the system offset.
Optionally, the multi-time-zone time display apparatus according to the embodiment of the present invention may further include a switching unit, configured to perform time zone switching display on the displayed time item after a time that arrives after a time corresponding to the fourth time parameter passes based on a preset reference time.
Optionally, the switching unit may include:
the first acquisition module is used for acquiring an original time length parameter corresponding to a time item of an original background time zone;
a first determining module, configured to determine an original background offset of the original background time zone relative to the middle time zone and a new background offset of a new background time zone relative to the middle time zone;
the second determining module is used for determining that the switched new time length parameter is equal to the original time length parameter plus the offset difference between the new background offset and the original background offset;
and the first display module is used for displaying the time which is reached after the time length corresponding to the new time length parameter passes by on the basis of the preset reference time in the new background time zone.
Optionally, the switching unit may include:
the second acquisition module is used for acquiring the original time length parameter corresponding to the time item of the original background time zone;
a first conversion module, configured to convert the original time length parameter into a system time length parameter corresponding to the current system time zone according to an original background offset of the original background time zone with respect to the middle time zone and a system offset of the current system time zone with respect to the middle time zone;
the second conversion module is used for converting the system time length parameter into a new time length parameter corresponding to a new background time zone according to a new background offset of the new background time zone relative to the middle time zone and the system offset;
and the second display module is used for displaying the time which is reached after the time length corresponding to the new time length parameter passes by on the basis of the preset reference time in the new background time zone.
In a fourth aspect, an embodiment of the present invention further provides a multi-time zone time allocation apparatus, which can simplify the multi-time zone time allocation operation, and effectively improve the multi-time zone time allocation efficiency and accuracy.
As shown in fig. 11, the apparatus for configuring time in multiple time zones according to an embodiment of the present invention may include:
a first determining unit 41, configured to determine a background time zone for the configuration operation, where the background time zone is one of 24 geographic time zones around the world;
a conversion unit 42, configured to convert a target configuration time input by a user into a first time length parameter, where the first time length parameter is equal to a time difference between the target configuration time and a preset reference time;
a first adjusting unit 43, configured to adjust the first duration parameter according to a background offset of the background time zone relative to the middle time zone, to obtain a second duration parameter corresponding to the target configuration time, and store the second duration parameter in a database; wherein, the middle time zone is the time zone of the first meridian in the 24 geographic time zones.
The multi-time zone time configuration device provided in the embodiment of the present invention can determine the time zone targeted by the configuration operation as the background time zone, convert the target configuration time input by the user into the first time length parameter, adjust the first time length parameter according to the background offset of the background time zone relative to the middle time zone, obtain the second time length parameter corresponding to the target configuration time, and directly store the second time length parameter in the database. Therefore, by establishing a management mechanism of the background time zone, a user does not need various complicated time zone conversions when configuring the time, and can realize the accurate configuration of the time zone only by selecting the corresponding background time zone, thereby greatly simplifying the time configuration operation of multiple time zones and effectively improving the efficiency and the accuracy of the time configuration of the multiple time zones.
Optionally, the first adjusting unit 43 may be specifically configured to:
determining the background offset of the background time zone relative to the middle time zone according to the relative relationship between the time zones;
and determining the second time length parameter according to the first time length parameter and the background offset, wherein the second time length parameter is equal to the sum of the first time length parameter and the background offset.
In a fifth aspect, an embodiment of the present invention further provides an electronic device, which can greatly simplify time configuration and/or display operations in multiple time zones, and effectively improve efficiency and accuracy of time configuration and/or display in multiple time zones.
As shown in fig. 12, an electronic device provided in an embodiment of the present invention may include: the device comprises a shell 51, a processor 52, a memory 53, a circuit board 54 and a power circuit 55, wherein the circuit board 54 is arranged inside a space enclosed by the shell 51, and the processor 52 and the memory 53 are arranged on the circuit board 54; a power supply circuit 55 for supplying power to each circuit or device of the electronic apparatus; the memory 53 is used to store executable program code; the processor 52 reads the executable program code stored in the memory 53 to run a program corresponding to the executable program code, and is configured to execute the time configuration method for multiple time zones or the time display method for multiple time zones provided in any of the foregoing embodiments.
For specific execution processes of the above steps by the processor 52 and further steps executed by the processor 52 by running the executable program code, reference may be made to the description of the foregoing embodiments, and details are not described herein again.
The above electronic devices exist in a variety of forms, including but not limited to:
(1) a mobile communication device: such devices are characterized by mobile communications capabilities and are primarily targeted at providing voice, data communications. Such terminals include: smart phones (e.g., iphones), multimedia phones, functional phones, and low-end phones, among others.
(2) Ultra mobile personal computer device: the equipment belongs to the category of personal computers, has calculation and processing functions and generally has the characteristic of mobile internet access. Such terminals include: PDA, MID, and UMPC devices, etc., such as ipads.
(3) A portable entertainment device: such devices can display and play multimedia content. This type of device comprises: audio, video players (e.g., ipods), handheld game consoles, electronic books, and smart toys and portable car navigation devices.
(4) A server: the device for providing the computing service comprises a processor, a hard disk, a memory, a system bus and the like, and the server is similar to a general computer architecture, but has higher requirements on processing capacity, stability, reliability, safety, expandability, manageability and the like because of the need of providing high-reliability service.
(5) And other electronic equipment with data interaction function.
In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where one or more programs are stored in the computer-readable storage medium, and the one or more programs can be executed by one or more processors to implement any one of the multiple time zone time configuration methods and the multiple time zone time display methods provided in the foregoing embodiments, so that corresponding technical effects can also be achieved, and the foregoing has been described in detail, and are not repeated herein.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments.
In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
For convenience of description, the above devices are described separately in terms of functional division into various units/modules. Of course, the functionality of the units/modules may be implemented in one or more software and/or hardware implementations of the invention.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (10)
1. A method for displaying time in multiple time zones is characterized by comprising the following steps:
reading a third duration parameter corresponding to the time item to be displayed from a preset database;
determining a background time zone on which the showing operation of the time item is based, wherein the background time zone is one of 24 geographic time zones around the world;
adjusting the third time length parameter according to the background offset of the background time zone relative to the middle time zone and the system offset of the current system time zone relative to the middle time zone to obtain a fourth time length parameter; wherein the middle time zone is a time zone in which the first meridian is located among the 24 geographic time zones;
and displaying the time item as the time reached after the time length corresponding to the fourth time length parameter is passed on the basis of the preset reference time.
2. The method of claim 1, wherein the adjusting the third duration parameter according to the background offset of the background time zone relative to the middle time zone and the system offset of the current system time zone relative to the middle time zone to obtain a fourth duration parameter comprises:
the fourth duration parameter is equal to the third duration parameter plus a difference between the background offset and the system offset.
3. The method according to claim 1, wherein the displaying the time item is performed after a time that is reached after a time corresponding to the fourth time parameter passes by based on a preset reference time, and the method further comprises:
and carrying out time zone switching display on the displayed time items.
4. The method of claim 3, wherein the time zone switching the displayed time items comprises:
acquiring an original time length parameter corresponding to a time item of an original background time zone;
determining an original background offset of the original background time zone relative to the middle time zone and a new background offset of a new background time zone relative to the middle time zone;
determining that the switched new duration parameter is equal to the original duration parameter plus the offset difference between the new background offset and the original background offset;
and displaying the time which is reached after the time length corresponding to the new time length parameter is passed based on the preset reference time in the new background time zone.
5. The method of claim 3, wherein the time zone switching the displayed time items comprises:
acquiring an original time length parameter corresponding to a time item of an original background time zone;
converting the original time length parameter into a system time length parameter corresponding to the current system time zone according to the original background offset of the original background time zone relative to the middle time zone and the system offset of the current system time zone relative to the middle time zone;
converting the system time length parameter into a new time length parameter corresponding to the new background time zone according to the new background offset of the new background time zone relative to the middle time zone and the system offset;
and displaying the time which is reached after the time length corresponding to the new time length parameter is passed based on the preset reference time in the new background time zone.
6. A method for time allocation in multiple time zones, comprising:
determining a background time zone for which configuration operation is directed, wherein the background time zone is one of 24 geographic time zones around the world;
converting a target configuration time input by a user into a first time length parameter, wherein the first time length parameter is equal to the time difference between the target configuration time and a preset reference time;
adjusting the first duration parameter according to the background offset of the background time zone relative to the middle time zone to obtain a second duration parameter corresponding to the target configuration moment, and storing the second duration parameter into a database; wherein, the middle time zone is the time zone of the first meridian in the 24 geographic time zones.
7. The method of claim 6, wherein the adjusting the first duration parameter according to the background offset of the background time zone relative to the middle time zone to obtain the second duration parameter corresponding to the target configuration time comprises:
determining the background offset of the background time zone relative to the middle time zone according to the relative relationship between the time zones;
and determining the second time length parameter according to the first time length parameter and the background offset, wherein the second time length parameter is equal to the sum of the first time length parameter and the background offset.
8. A time display apparatus for multiple time zones, comprising:
the reading unit is used for reading a third duration parameter corresponding to the time item to be displayed from a preset database;
a second determining unit, configured to determine a background time zone on which the displaying operation of the time item is based, where the background time zone is one of 24 geographic time zones around the world;
a second adjusting unit, configured to adjust the third duration parameter according to a background offset of the background time zone relative to a middle time zone and a system offset of a current system time zone relative to the middle time zone, so as to obtain a fourth duration parameter; wherein the middle time zone is a time zone in which the first meridian is located among the 24 geographic time zones;
and the display unit is used for displaying the time item as the time which is reached after the time length corresponding to the fourth time length parameter is passed on the basis of the preset reference time.
9. The apparatus according to claim 8, wherein the second adjusting unit is specifically configured to adjust the third duration parameter to the fourth duration parameter, and the fourth duration parameter is equal to the third duration parameter plus a difference between the background offset and the system offset.
10. The apparatus according to claim 9, further comprising a switching unit configured to perform time zone switching display on the displayed time item after displaying the time item as an arrival time after a time corresponding to the fourth time parameter passes based on a preset reference time.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910927893.7A CN110716781B (en) | 2019-09-27 | 2019-09-27 | Time display method, configuration method and device for multiple time zones |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910927893.7A CN110716781B (en) | 2019-09-27 | 2019-09-27 | Time display method, configuration method and device for multiple time zones |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110716781A true CN110716781A (en) | 2020-01-21 |
CN110716781B CN110716781B (en) | 2023-06-02 |
Family
ID=69211121
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910927893.7A Active CN110716781B (en) | 2019-09-27 | 2019-09-27 | Time display method, configuration method and device for multiple time zones |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110716781B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111683215A (en) * | 2020-06-05 | 2020-09-18 | 杭州海康威视数字技术股份有限公司 | Video playback method and device, electronic equipment and computer readable storage medium |
CN112686697A (en) * | 2020-12-29 | 2021-04-20 | 百果园技术(新加坡)有限公司 | Multi-dimension-based user behavior data processing method and device |
CN114971676A (en) * | 2022-04-08 | 2022-08-30 | 百果园技术(新加坡)有限公司 | An activity event management system, method and device |
Citations (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5841972A (en) * | 1997-01-03 | 1998-11-24 | Ncr Corporation | System using displayed configuration utility on monitor including list of target nodes, for administering interconnected nodes of computer network |
US20020122355A1 (en) * | 2001-01-10 | 2002-09-05 | Williams Joseph F. | Universal time zone conversion |
CN1877620A (en) * | 2005-04-25 | 2006-12-13 | 国际商业机器公司 | Method and system for visualizing multiple time zones in a calendaring and scheduling application |
CN1983315A (en) * | 2006-04-30 | 2007-06-20 | 华为技术有限公司 | System and method for synchronizing schedule reminding time zone |
JP2009043159A (en) * | 2007-08-10 | 2009-02-26 | Toshiba Solutions Corp | Trading time display program and device |
CN101387864A (en) * | 2008-09-28 | 2009-03-18 | 深圳华为通信技术有限公司 | Time display method and apparatus |
CN101997714A (en) * | 2009-08-27 | 2011-03-30 | 华为技术有限公司 | Time processing method, device and system |
CN103092959A (en) * | 2013-01-18 | 2013-05-08 | 中兴通讯股份有限公司 | Processing method and device for task time zone |
CN103188396A (en) * | 2011-12-29 | 2013-07-03 | 三星电子(中国)研发中心 | Device and method for setting time information of affairs to be done in mobile terminals |
JP2013168711A (en) * | 2012-02-14 | 2013-08-29 | Nec Casio Mobile Communications Ltd | Electronic equipment, information display system, information display method, and program |
US20150199077A1 (en) * | 2013-05-23 | 2015-07-16 | Google Inc. | Scheduling and viewing a calender event using time zones based on a user's location at event time |
CN105892806A (en) * | 2016-03-29 | 2016-08-24 | 乐视控股(北京)有限公司 | Display method and device for multinational time-zone clocks and intelligent terminal |
CN108156233A (en) * | 2017-12-20 | 2018-06-12 | 惠州Tcl家电集团有限公司 | Data processing method, device and computer readable storage medium |
CN108605069A (en) * | 2017-01-25 | 2018-09-28 | 华为技术有限公司 | A kind of schedule processing method and electric terminal |
-
2019
- 2019-09-27 CN CN201910927893.7A patent/CN110716781B/en active Active
Patent Citations (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5841972A (en) * | 1997-01-03 | 1998-11-24 | Ncr Corporation | System using displayed configuration utility on monitor including list of target nodes, for administering interconnected nodes of computer network |
US20020122355A1 (en) * | 2001-01-10 | 2002-09-05 | Williams Joseph F. | Universal time zone conversion |
CN1877620A (en) * | 2005-04-25 | 2006-12-13 | 国际商业机器公司 | Method and system for visualizing multiple time zones in a calendaring and scheduling application |
CN1983315A (en) * | 2006-04-30 | 2007-06-20 | 华为技术有限公司 | System and method for synchronizing schedule reminding time zone |
JP2009043159A (en) * | 2007-08-10 | 2009-02-26 | Toshiba Solutions Corp | Trading time display program and device |
CN101387864A (en) * | 2008-09-28 | 2009-03-18 | 深圳华为通信技术有限公司 | Time display method and apparatus |
CN101997714A (en) * | 2009-08-27 | 2011-03-30 | 华为技术有限公司 | Time processing method, device and system |
CN103188396A (en) * | 2011-12-29 | 2013-07-03 | 三星电子(中国)研发中心 | Device and method for setting time information of affairs to be done in mobile terminals |
JP2013168711A (en) * | 2012-02-14 | 2013-08-29 | Nec Casio Mobile Communications Ltd | Electronic equipment, information display system, information display method, and program |
CN103092959A (en) * | 2013-01-18 | 2013-05-08 | 中兴通讯股份有限公司 | Processing method and device for task time zone |
US20150199077A1 (en) * | 2013-05-23 | 2015-07-16 | Google Inc. | Scheduling and viewing a calender event using time zones based on a user's location at event time |
CN105892806A (en) * | 2016-03-29 | 2016-08-24 | 乐视控股(北京)有限公司 | Display method and device for multinational time-zone clocks and intelligent terminal |
CN108605069A (en) * | 2017-01-25 | 2018-09-28 | 华为技术有限公司 | A kind of schedule processing method and electric terminal |
CN108156233A (en) * | 2017-12-20 | 2018-06-12 | 惠州Tcl家电集团有限公司 | Data processing method, device and computer readable storage medium |
Non-Patent Citations (1)
Title |
---|
舒翔;: "J2EE系统中日期时间的处理方法", 电脑与电信, no. 11 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111683215A (en) * | 2020-06-05 | 2020-09-18 | 杭州海康威视数字技术股份有限公司 | Video playback method and device, electronic equipment and computer readable storage medium |
CN112686697A (en) * | 2020-12-29 | 2021-04-20 | 百果园技术(新加坡)有限公司 | Multi-dimension-based user behavior data processing method and device |
CN114971676A (en) * | 2022-04-08 | 2022-08-30 | 百果园技术(新加坡)有限公司 | An activity event management system, method and device |
Also Published As
Publication number | Publication date |
---|---|
CN110716781B (en) | 2023-06-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20150262583A1 (en) | Information terminal and voice operation method | |
CN110716781A (en) | Multi-time zone time display method, configuration method and device | |
EP2747441A1 (en) | Multi-terminal synchronous play control method and apparatus | |
US20130232436A1 (en) | Method, electronic map, and mobile terminal for generating map phone book | |
CN102308272A (en) | Method and device for automatic display of applications on home screen | |
US11004445B2 (en) | Information processing method, server, terminal, and information processing system | |
CN107766455B (en) | Lyric pickup method, device and computer readable storage medium | |
CN104978045B (en) | A kind of Chinese character input method and device | |
CN110875871A (en) | Management method of instant messaging application and electronic equipment | |
CN105338154A (en) | Method, device and terminal for contact person ordering | |
CN111291281A (en) | Charging equipment recommendation method and device | |
CN108769232A (en) | Application resource method for pushing, device, equipment and storage medium | |
CN101833574A (en) | Application positioning method, system and mobile terminal | |
CN105468440B (en) | Information display method and device and electronic equipment | |
CN103262514A (en) | Methods and systems for automated business dialing | |
CN113449086A (en) | Dialogue management method, device and storage medium | |
CN103607698A (en) | Method for concentrating application programs and terminal | |
CN112084432B (en) | Information display method and device and electronic equipment | |
CN105957541A (en) | Music operation control method and device and mobile device | |
EP2756426A1 (en) | Locale centric search optimization in response to user opt-in | |
CN106371853A (en) | Learning application program starting method and device | |
CN104918236B (en) | Environment decision-making system and method based on Wi-Fi | |
CN109495190B (en) | Envelope compression point determination method and related equipment | |
CN107743151B (en) | Content push method, device, mobile terminal and server | |
CN110196442A (en) | Search star method, apparatus, storage medium and mobile terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |