Date and time standardization processing method and device, equipment and storage medium

By defining the separator parameters to process dates and times, the problem of the existing API lacking unified formatting function is solved, and unified date and time format processing is realized, reducing code redundancy, improving system stability and maintainability, and is suitable for multiple people Collaborative development environment.

CN119005143APending Publication Date: 2024-11-22PING AN BANK CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411144415.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

The existing API lacks a unified date and time formatting function, which causes developers to manually process dates and times, resulting in redundant and inconsistent code, affecting system stability and business logic accuracy, especially in a multi-person collaborative development environment. Unified norms.

Method used

By defining separator parameters, obtain the date and time in the front-end interface, split and splice it into standardized date and time strings, support user-defined and default separators, adapt to different regional and cultural environments, and provide unified date and time format processing method.

Benefits of technology

It realizes unified date and time format processing, reduces redundant code, improves system stability and maintainability, and is suitable for multi-person collaborative development environments to ensure business unity and standardization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119005143A_ABST
    Figure CN119005143A_ABST
Patent Text Reader

Abstract

The invention relates to a date and time standardization processing method, which comprises the following steps of: defining a separator parameter which is used for determining a separator format between a date character string and a time character string; acquiring the current date and time in the front-end interface, and respectively converting the current date and time into a date character string and a time character string which comprise years, months, dates, hours, minutes and seconds; and splicing the date character string and the time character string by utilizing the separator parameter, and inserting a separator between the date element and the time element so as to generate a standardized date and time character string. Uniform date and time format processing can be achieved, redundant codes are reduced, the development process is simplified, the stability and maintainability of the system are improved, the method is suitable for projects needing standardized date and time processing, especially in a multi-person cooperation development environment, the method can serve as a universal tool type method, consistent date and time processing logic is achieved, and the development efficiency is improved. And the business uniformity and normalization are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data standardization processing, and in particular to a method, device, equipment and storage medium for standardizing processing of date and time. Background Art

[0002] Date formatting is one of the most commonly used techniques in computer programming and software development. In many application scenarios, developers need to process date and time data, which usually involves formatting the date and time into a specific string form. However, most developers currently rely on the basic API capabilities provided by the industry, which usually only provide basic date and time formatting functions, such as simple date or time formats.

[0003] However, the existing APIs do not uniformly provide comprehensive formatting functions including year, month, day and timestamp, and developers often need to handle such requirements by themselves in actual projects. This processing method usually requires developers to manually call native APIs to perform special processing on the year, month, day, and then splice it with the timestamp. This frequent manual operation is not only prone to code redundancy and inconsistent standards, but may also introduce errors, affecting the stability of the system and the accuracy of business logic.

[0004] In addition, when multiple developers collaborate on the same project, they each write different codes for the same date and time processing requirements, which further increases the complexity of the system and is not conducive to unified specifications and standardized management. The way of handling these date formats separately makes the system face greater challenges during maintenance and upgrades, reducing development efficiency and code consistency. Summary of the invention

[0005] The main purpose of the present invention is to provide a method, device, equipment and storage medium for standardizing date and time processing, aiming to solve the technical problem that the prior art lacks a unified date and time format processing method.

[0006] To achieve the above object, the present invention provides a method for standardizing date and time, comprising:

[0007] Define a separator parameter, which is used to determine the separator in the date string and the time string;

[0008] Get the current date and time in the front-end interface to form a current date string and a current time string, where the date includes year, month and day, and the time includes hours, minutes and seconds;

[0009] The current date character string and the current time character string are concatenated using the separator parameter, and the separator is added to the current date character string and the current time character string to obtain a standardized date and time character string.

[0010] In one embodiment, defining the delimiter parameters includes:

[0011] Define a parameter variable of string type to determine whether the user-specified separator is received;

[0012] If so, storing the user-specified separator into the parameter variable to obtain the separator parameter;

[0013] If not, a default separator is set in the parameter variable to obtain the separator parameter.

[0014] In one embodiment, storing the user-specified delimiter in the parameter variable to obtain the delimiter parameter includes:

[0015] Matching the user-specified delimiter with a standard delimiter library to determine whether the user-specified delimiter meets the standard;

[0016] If so, storing the user-specified separator into the parameter variable to obtain the separator parameter;

[0017] If not, the default delimiter is stored in the parameter variable, the delimiter parameter is obtained, and the user is prompted that the specified delimiter input does not meet the standard or is an invalid delimiter.

[0018] In one embodiment, defining the delimiter parameters includes:

[0019] Build a locale parameter database containing time zone information and / or system language setting information, and establish a time zone language mapping table;

[0020] Obtain the current time zone information and system language setting information of the front-end interface, search for matching locale parameters in the locale parameter database according to the order of complete match, time zone information match and system language setting information match, and obtain the current locale parameters;

[0021] A separator parameter matching the current locale parameter is selected from the time zone language mapping table.

[0022] In one embodiment, the step of concatenating the current date string and the current time string using the separator parameter, adding the separator to the current date string and the current time string, and obtaining a standardized date and time string includes:

[0023] Split the date into date characters according to year, month and day, and split the time into time characters according to hour, minute and second;

[0024] Add a character 0 before the date character and time character that is less than 10, and keep the characters in other date characters and other time characters unchanged;

[0025] All date characters and time characters are concatenated using the separator parameter in the order of year, month, date, hour, minute and second, and the separator is inserted between the date characters and the time characters to obtain the standardized date and time character string.

[0026] In one embodiment, the step of concatenating the current date string and the current time string using the separator parameter, adding the separator to the current date string and the current time string, and obtaining a standardized date and time string includes:

[0027] The separator parameter is a parameter of the formatting template, which is used to define the output format of the date character and the time character, and the separator parameter is parsed to identify the date element and time element corresponding to each part of the formatting template and the separator between the elements;

[0028] The current date character string and the current time character string are matched with the date element and the time element in the formatting template, and separators between the elements are added to the date character string and the time character string to obtain a standardized date and time character string that conforms to the output format.

[0029] In one embodiment, after obtaining the standardized date and time string, the method further includes:

[0030] Receiving an output type parameter sent by a user, and identifying content of the output type parameter;

[0031] If the value of the output type parameter is string, the standardized date and time string is directly returned to the user;

[0032] If the value of the output type parameter is json, split the standardized date and time string into a date part and a time part, convert the date part and the time part into a string of JSON type and return it to the user;

[0033] If the value of the output type parameter is object, the standardized date and time string is parsed, and the date element and time element therein are encapsulated as an object or a data structure and returned to the user.

[0034] Furthermore, to achieve the above object, the present invention also provides a device for standardizing date and time, comprising:

[0035] A separator definition module is used to define separator parameters, where the separator parameters are used to determine separators in a date character string and a time character string;

[0036] The date and time acquisition module acquires the current date and time in the front-end interface to form a current date string and a current time string. The date includes year, month and day, and the time includes hours, minutes and seconds.

[0037] The standardization processing module uses the separator parameter to concatenate the current date character string and the current time character string, and adds the separator to the current date character string and the current time character string to obtain a standardized date and time character string.

[0038] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a standardized processing device for date and time, the standardized processing device for date and time includes a memory, a processor, and a standardized processing program for date and time stored in the memory and executable on the processor, and the standardized processing program for date and time, when executed by the processor, implements the steps of the standardized processing method for date and time as described above.

[0039] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a computer storage medium, on which a standardized processing program for date and time is stored, and when the standardized processing program for date and time is executed by a processor, the steps of the standardized processing method for date and time as described above are implemented.

[0040] Beneficial effects: The present invention relates to a standardized processing method for date and time, by defining a separator parameter, which is used to determine the separator format between the date string and the time string; obtaining the current date and time in the front-end interface, and converting them into a date string and a time string containing year, month, date, hour, minute and second respectively; using the separator parameter, splicing the date string and the time string, and inserting a separator between the date and time elements, thereby generating a standardized date and time string. Unified date and time format processing can be achieved, redundant code can be reduced, the development process can be simplified, and the stability and maintainability of the system can be improved. It is suitable for projects that require standardized date and time processing, especially in a multi-person collaborative development environment. It can be used as a general tool class method to achieve consistent date and time processing logic and ensure the uniformity and standardization of the business. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0042] Figure 1 It is a flowchart of a first embodiment of a method for standardizing date and time according to the present invention;

[0043] Figure 2 A schematic diagram of functional modules of a preferred embodiment of a device for standardizing date and time according to the present invention;

[0044] Figure 3 It is a structural schematic diagram of the device hardware operating environment involved in the embodiment of the device for standardizing date and time processing of the present invention. DETAILED DESCRIPTION

[0045] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0046] It should be noted that date formatting is one of the most commonly used techniques in computer programming and software development. In many application scenarios, developers need to process date and time data, which usually involves formatting the date and time into a specific string form. However, most developers currently rely on the basic API capabilities provided by the industry, which usually only provide basic date and time formatting functions, such as simple date or time formats.

[0047] However, the existing APIs do not uniformly provide comprehensive formatting functions including year, month, day and timestamp, and developers often need to handle such requirements by themselves in actual projects. This processing method usually requires developers to manually call native APIs to perform special processing on the year, month, day, and then splice it with the timestamp. This frequent manual operation is not only prone to code redundancy and inconsistent standards, but may also introduce errors, affecting the stability of the system and the accuracy of business logic.

[0048] In addition, when multiple developers collaborate on the same project, they each write different codes for the same date and time processing requirements, which further increases the complexity of the system and is not conducive to unified specifications and standardized management. The way of handling these date formats separately makes the system face greater challenges during maintenance and upgrades, reducing development efficiency and code consistency.

[0049] In order to solve the above problems, the present invention proposes a method for standardizing date and time. Figure 1 , Figure 1 This is a flow chart of a first embodiment of a method for standardizing date and time provided by the present invention.

[0050] The present invention also provides a device for standardizing date and time, referring to Figure 2 , Figure 2Schematic diagram of functional modules of a preferred embodiment of the date and time standardization processing device of the present invention.

[0051] The present invention also provides a date and time standardization processing device, referring to Figure 3 , Figure 3 It is a structural schematic diagram of the device hardware operating environment involved in the embodiment of the device for standardizing date and time processing of the present invention.

[0052] like Figure 3 As shown, the standardized processing device for date and time may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0053] Those skilled in the art will understand that Figure 3 The hardware structure of the date and time standardization processing device shown in the figure does not constitute a limitation on the date and time standardization processing device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0054] like Figure 3 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a date and time standardization processing program. The operating system is a program for managing and controlling date and time standardization processing equipment and software resources, and supports the operation of the network communication module, the user interface module, the date and time standardization processing program, and other programs or software; the network communication module is used to manage and control the network interface 1004; and the user interface module is used to manage and control the user interface 1003.

[0055] exist Figure 3In the hardware structure of the date and time standardization processing device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client and communicate data with the client; the processor 1001 can call the date and time standardization processing program stored in the memory 1005, and perform the same operation as the date and time standardization processing method.

[0056] The specific implementation of the device for standardizing date and time of the present invention is basically the same as the embodiments of the method for standardizing date and time described below, and will not be described in detail here.

[0057] The embodiment of the present invention provides an embodiment of a method for standardizing date and time. It should be noted that although a logical order is shown in the flow chart, in some cases, the steps shown or described may be executed in an order different from that shown here.

[0058] In various embodiments of the method for standardizing date and time, the execution subject is a device for standardizing date and time.

[0059] like Figure 1 As shown, a first embodiment of a method for standardizing date and time of the present invention is proposed, which specifically includes the following steps:

[0060] S10, defining a separator parameter, wherein the separator parameter is used to determine a separator in a date character string and a time character string;

[0061] In this embodiment, the separator parameter is used to insert an appropriate separator between the date string and the time string to generate a standardized date and time format. The separator parameter can be defined in a variety of ways to ensure that the processing of the date and time format can maintain consistency and standardization in different application scenarios.

[0062] In one specific implementation, defining the delimiter parameter may be based on the default delimiter processing:

[0063] The system presets a default separator, such as a slash ' / ', to process the year, month, and day parts of the date string. In this way, the obtained date is August 16, 2024, and the time is 14:30:00. The system converts the date part to the string 2024 / 08 / 16, while the time part maintains the standard format 14:30:00, using a colon : to separate hours, minutes, and seconds. Finally, the system concatenates the date and time parts into a complete standardized date and time string 2024 / 08 / 1614:30:00. This default method is suitable for most application scenarios and ensures the uniformity of the format.

[0064] In another specific implementation, the delimiter parameter may be defined based on a user-defined delimiter process:

[0065] The system allows users to customize the separator of the date part according to specific needs. For example, the user selects a hyphen '-' as the separator. After obtaining the current date and time, the system converts the date part into a string '2024-08-16', and the time part remains in the format of '14:30:00'. Finally, the generated standardized date and time string is '2024-08-16 14:30:00'. This method is particularly suitable for applications that require customized formats to meet the personalized needs of users.

[0066] In another specific implementation, the delimiter parameter can be dynamically adjusted based on the delimiter of the locale:

[0067] The system can dynamically adjust the separator of the date part according to the user's locale. For example, when the system detects that the user's locale is the United States ('en-US'), the slash ' / ' is used as the separator by default, and the generated date and time string is '08 / 16 / 2024 14:30:00'. If the user's locale is Germany ('de-DE'), the system automatically selects the period . as the separator of the date part, and the generated string is '16.08.2024 14:30:00'. In this way, the system can automatically adapt to the date and time format of the user's region and improve the user experience.

[0068] In another specific implementation, the delimiter parameter may be defined based on composite delimiter processing:

[0069] In some specific application scenarios, the system may need to use composite delimiters, that is, delimiters containing multiple characters. For example, in an interface that requires high aesthetics and readability, a combination of 'space + slash' can be used as a delimiter for the date part. When the obtained date and time are August 16, 2024 and 14:30:00, the system will generate a standardized date and time string of 2024 / 08 / 1614:30:00. This method improves the visual effect of the user interface and the readability of the date and time information.

[0070] Example

[0071] In a global e-commerce platform, the system needs to automatically adjust the date and time format according to the user's regional settings. Assuming that the user's regional settings are the United Kingdom (en-GB), the system uses a hyphen - as the separator between the date and time strings by default, and uses a colon : to separate the time elements. The obtained date is August 16, 2024, and the time is 14:30:00. The standardized date and time string generated by the system is 16-08-2024 14:30:00.

[0072] In another scenario, a multi-language project management system allows users to define their own separators. Users can select separators in the system settings, such as a period. The generated date and time string will be 16.08.202414.30.00. This flexible separator setting method not only enhances the adaptability of the system, but also meets the personalized needs of different users.

[0073] In an application involving cross-platform data transmission, the system may need to generate a date and time string that complies with the ISO 8601 standard. In this case, the separator parameter can be set to T to separate the date and time parts. The date obtained by the system is August 16, 2024, and the time is 14:30:00. The final generated string is 2024-08-16T14:30:00, ensuring the consistency of the data format in international standards.

[0074] By defining and using separator parameters, the flexibility and consistency of date and time format processing can be significantly improved. It allows the generation of suitable date and time strings according to specific needs and user settings, reducing the complexity of manual splicing and the risk of code redundancy. In addition, the dynamic adjustment capability of separator parameters enables the system to automatically adapt to different language and cultural environments, improving user experience and system portability. In this way, the system is enhanced in terms of maintainability and scalability, while ensuring the stability and consistency of business logic.

[0075] S20, obtaining the current date and time in the front-end interface to form a current date character string and a current time character string, wherein the date includes year, month and day, and the time includes hours, minutes and seconds;

[0076] In this embodiment, the current date and time of the user device are obtained from the front-end interface, and these data are converted into a standardized date character string and time character string respectively.

[0077] The front-end interface usually refers to the graphical user interface (GUI) that users use to interact with applications or websites on devices such as computers, mobile phones, and tablets. This is the part that users directly see and operate, and is the "user-facing" side of the application. The front-end interface interacts with the user through visual elements (such as buttons, input boxes, date pickers, etc.), and passes the user's input to the backend for processing. The application can obtain the current date and time on the user's device through a control on the front-end interface (such as a date picker, time picker, or the current system time directly obtained through JavaScript). This information is then processed and converted into the format required by the application.

[0078] In one specific implementation, the date and time can be obtained by using the built-in API of the browser:

[0079] In modern browser environments, the system can use JavaScript's Date object to get the current date and time. The system first gets the complete object of the current time through new Date(), and then extracts the year, month, day, hour, minute, and second. Then, these data are converted into two strings: one represents the date part (such as 2024-08-16), and the other represents the time part (such as 14:30:00). The generated date string and time string can be used for formatting or display in subsequent steps.

[0080] In another specific implementation, the date and time selected by the user can be obtained from the controls of the front-end interface:

[0081] In some scenarios, users may manually select dates and times through the date picker and time picker on the front-end interface. The system extracts the user-selected data from these controls and converts them into date strings and time strings, respectively. For example, if the user selects August 16, 2024 in the date picker and 14:30:00 in the time picker, the system will generate two strings, 2024-08-16 and 14:30:00, for further processing or display.

[0082] In another specific implementation, the current date and time can be obtained from the device system:

[0083] In mobile apps or desktop apps, the system can directly obtain the current date and time through the device operating system's API. These APIs usually provide richer time data and format options than browsers. The system obtains the current date and time by calling the operating system's API and converts them into standardized date strings and time strings respectively. This method ensures that the obtained time data is accurate and consistent with the device settings.

[0084] In another specific implementation, the unified date and time can be obtained from the server:

[0085] In a distributed system or multi-user environment, in order to ensure that all users get the same time, the system can get the current date and time from the server. The server returns a standardized timestamp, which the system parses into the date part and the time part, and converts into a date string and a time string respectively. This method is particularly suitable for scenarios that require synchronized time, such as online games or time management of distributed databases.

[0086] Example

[0087] On an e-commerce platform, when a user places an order, the system needs to record the time when the order was generated. The system obtains the current date and time from the browser, generates a date string of 2024-08-16 and a time string of 14:30:00, and then saves it to the order record. In this way, both the user and the backend system can clearly see the time when the order was generated, and ensure that the time record of order processing is accurate.

[0088] In another scenario, a conference booking system allows users to select the date and time of a meeting. The user selects August 16, 2024 through the date selector on the front-end interface and selects 14:30 through the time selector. The system will generate a date string of 2024-08-16 and a time string of 14:30:00, respectively, to display to the user on the confirmation page and save to the database to ensure that the meeting information is accurate.

[0089] By obtaining the current date and time from different sources (such as browser API, front-end controls, operating system or server) and converting them into standardized date and time strings, the system can ensure the accuracy, consistency and ease of processing of date and time data. This method not only improves the readability and processing efficiency of data, but also adapts to a variety of application scenarios, ensuring the flexibility and stability of the system.

[0090] S30, concatenating the current date character string and the current time character string using the separator parameter, adding the separator to the current date character string and the current time character string, and obtaining a standardized date and time character string.

[0091] In this embodiment, the acquired date string and time string are combined by using the specified separator parameter to generate a standardized date and time string. For example, the generated date string and time string are concatenated by using the concatenation process, and a proper separator is added between the date and time using the separator parameter to ensure that the generated date and time string meets the expected format requirements.

[0092] In one specific implementation, the splicing method may be splicing based on a unified separator ' / ':

[0093] In this method, the system selects slash / as the unified separator for the date part and the time part. The system obtains the current date and time, converts the date part to 2024 / 08 / 16, and the time part to 14 / 30 / 00. Then, the system concatenates the date and time with a space separator, and the generated standardized date and time string is 2024 / 08 / 16 14 / 30 / 00. This method ensures that all parts of the date and time use the same separator, which is suitable for scenarios that require a unified format. .

[0094] In another specific implementation, the splicing method may be based on a combination of different separators:

[0095] In this implementation, the system can select different separators for the date and time parts. Assume that the date part uses a hyphen -, the time part uses a colon :, and a space is used as a separator between the date and time. The current date obtained by the system is 2024-08-16 and the time is 14:30:00. The system concatenates the date and time into 2024-08-16 14:30:00. This method ensures that the format of the date and time is clear and readable and meets international standards.

[0096] In another specific implementation, the concatenation method may be based on the concatenation of date and time without separators:

[0097] In some application scenarios, no separator is required between the date and time, and the system simply concatenates them directly. For example, the system uses a period as a separator for the date and a colon as a separator for the time, but does not use any separator to connect the date and time parts. The obtained date string is 2024.08.16, the time string is 14:30:00, and the final generated date and time string is 2024.08.1614:30:00. This method can be used in scenarios that require a compact format.

[0098] In another specific implementation, the concatenation method may be based on the concatenation of a custom date, time, and a separator between the date and time:

[0099] The system allows users to customize the date, time, and separators between date and time. For example, the user chooses to use a hyphen - as the separator for the date part, a period . as the separator for the time part, and a colon : as the separator between the date and time. The system-generated date and time string will be 2024-08-16:14.30.00. This approach provides maximum flexibility and is suitable for scenarios where users have specific format requirements.

[0100] Example

[0101] One example is: In a development environment, multiple developers often need to process date and time data in different modules. If each developer manually processes the date and time strings and uses different separators, it is easy to cause inconsistent code styles and increase maintenance difficulties.

[0102] In order to unify the code style and simplify the date and time processing logic, the development team decided to use slash / as a unified separator. Developers need to write a function that gets the current date and time from the system and uses / as the separator for the date and time parts, while using a space to connect the date and time parts. The generated standardized date and time string format is 2024 / 08 / 16 14 / 30 / 00, which is suitable for scenarios that require a unified format, such as logging and file naming.

[0103] Another example is: in some complex application scenarios, different modules or systems may have different requirements for the date and time formats, for example, the date part uses a hyphen -, and the time part uses a colon :. In order to ensure the compatibility of data formats between systems, developers need to flexibly respond to these requirements.

[0104] Developers need to implement a function that can flexibly use different separators to process the date and time parts. For example, the date part is separated by -, the time part is separated by :, and the date and time parts are connected by a space. The generated date and time string is 2024-08-16 14:30:00, which ensures the consistency of data format within the system and across systems, and is suitable for scenarios such as data transmission and interface calls.

[0105] By specifying the application of separator parameters to date, time, and between date and time, the system can generate standardized date and time strings that meet format requirements according to needs. Whether using a unified separator or specifying different separators for date, time, and their connected parts, the system can flexibly adapt to various application scenarios. This not only improves the flexibility and readability of date and time format processing, but also simplifies code implementation and ensures data consistency and standardization.

[0106] The present invention relates to a standardized processing method for date and time, by defining a separator parameter, the parameter is used to determine the separator format between a date string and a time string; obtaining the current date and time in a front-end interface, and converting them into a date string and a time string containing year, month, date, hour, minute and second respectively; using the separator parameter, splicing the date string and the time string, and inserting a separator between the date and time elements, so as to generate a standardized date and time string. The method can realize unified date and time format processing, reduce redundant codes, simplify the development process, and improve the stability and maintainability of the system, and is suitable for projects that require standardized date and time processing, especially in a multi-person collaborative development environment, and can be used as a general tool class method to realize consistent date and time processing logic, and ensure the uniformity and standardization of business.

[0107] Furthermore, a second embodiment of the method for standardizing date and time of the present invention is proposed. In the above S10, the definition of separator parameters includes:

[0108] S101, defining a parameter variable of string type, and determining whether a user-specified separator is received;

[0109] S102, if yes, store the user-specified separator into the parameter variable to obtain the separator parameter;

[0110] S103: If not, set a default separator in the parameter variable to obtain the separator parameter.

[0111] In this embodiment, the parameter variable of string type refers to a variable used to store a delimiter, which can be a delimiter specified by the user or a default delimiter preset by the system. The system first checks whether the delimiter specified by the user is received. If received, the system stores it in the parameter variable; if not received, the system automatically uses the default delimiter.

[0112] In one specific implementation, the user can specify his own delimiter through a configuration file or a user interface. The system checks the user input to determine whether a valid delimiter is received. If the user specifies a delimiter, such as -, the system stores the delimiter in a parameter variable of a string type and uses the delimiter in subsequent date and time processing operations.

[0113] In another specific implementation, when the user does not specify a delimiter or does not provide a valid delimiter, the system automatically uses a preset default delimiter. The default delimiter can be a common symbol, such as a slash / or a hyphen -. The system stores the default delimiter in a parameter variable to ensure that the generation process of the date and time string is not interrupted due to the lack of a delimiter. This method is suitable for most application scenarios where users do not need to specifically customize delimiters.

[0114] In another specific implementation, the system may dynamically select separators based on the environment or the user's regional settings. If the user does not specify a separator, the system will automatically select an appropriate default separator based on the detected environment information (such as language, region). For example, in the United States, the system may use slashes / as separators by default, while in Europe, the system may use periods . as separators by default. This approach ensures that the generated date and time string conforms to the habits of the user's region.

[0115] In another specific implementation, after receiving the delimiter specified by the user, the system can also perform verification to ensure that the delimiter is valid and complies with the specification. If the system detects that the user has entered an invalid delimiter, such as one containing illegal characters or exceeding a certain length, the system will not use the delimiter, but will automatically fall back to the preset default delimiter. This mechanism increases the robustness of the system and avoids system anomalies caused by user input errors.

[0116] By defining and processing separator parameters, the system can flexibly adapt to user needs or changes in the environment, ensuring that the processing of the date and time format can meet expectations. Whether the user customizes the separator or uses the system default separator, the system can generate a consistent and standardized date and time string. This processing method improves the adaptability and fault tolerance of the system and reduces errors caused by improper separator processing.

[0117] Furthermore, a third embodiment of the method for standardizing date and time of the present invention is proposed. In the above S102, the storing of the user-specified separator into the parameter variable to obtain the separator parameter includes:

[0118] S1021, matching the user-specified delimiter with a standard delimiter library to determine whether the user-specified delimiter complies with the standard;

[0119] S1022, if yes, store the user-specified separator into the parameter variable to obtain the separator parameter;

[0120] S1023, if not, the default delimiter is stored in the parameter variable, the delimiter parameter is obtained, and the user is prompted that the specified delimiter input does not meet the standard or is an invalid delimiter.

[0121] In this embodiment, the standard delimiter library is a predefined delimiter set, which includes delimiters that the system considers to be valid and commonly used, such as -, / , ., :, etc. The system uses this library to verify whether the delimiter input by the user meets the specification.

[0122] The system first matches the user-specified delimiter with the entries in the standard delimiter library. If the match is successful, the system stores the user-specified delimiter in the parameter variable and uses it. If the match fails, the system uses the default delimiter and prompts the user that the delimiter entered is invalid or does not meet the standard.

[0123] In one specific embodiment, the system includes a predefined standard delimiter library, for example, including commonly used delimiters -, / , ., :. When the user specifies a delimiter, the system matches the delimiter with the standard delimiter library. If the match is successful, the system stores the delimiter in a parameter variable and uses it to format the date and time. If the match fails, the system uses a default delimiter (such as / ) and notifies the user that the delimiter he entered is invalid.

[0124] In another specific implementation, the system needs to support a complex delimiter validation mechanism. For example, the system not only checks the content of the delimiter, but also checks its length and character type. The standard delimiter library may contain characters with a length of 1, such as -, ., and :. When the delimiter entered by the user contains multiple characters or contains unallowed characters (such as letters, spaces, etc.), the system will judge it as an invalid delimiter and automatically fall back to the default delimiter, while prompting the user the reason for the error.

[0125] In another specific implementation, the system may dynamically adjust the delimiter validation rules according to the context or operating environment of the user. For example, in certain specific scenarios, the system may allow longer delimiters or customized delimiters, but in most scenarios only standard delimiters are accepted. The system will determine whether the delimiter entered by the user meets the standard based on the context information, and prompt the user when the match fails, and automatically switch to the context-related default delimiter.

[0126] In another specific implementation, the system may allow an administrator or advanced user to expand the standard delimiter library. For example, an administrator may add a new delimiter entry to the standard delimiter library to make it a standard delimiter recognized by the system. When a new delimiter specified by a user is not in the original standard delimiter library but has been added by an administrator, the system considers it valid and stores it in a parameter variable. This method increases the flexibility and scalability of the system and meets the use of delimiters in specific demand scenarios.

[0127] Example description:

[0128] During the development process, the system allows users to enter custom delimiters for formatting date and time strings. The system first matches the delimiter entered by the user with a predefined library of standard delimiters (such as -, / , ., :, etc.). If the match is successful, the system stores the delimiter in a parameter variable, and subsequent processing will use the delimiter. If the match fails, the system automatically falls back to the default delimiter (such as / ) and prompts the user that the delimiter they entered is invalid or does not meet the standard.

[0129] This embodiment matches and verifies the separator specified by the user with the standard separator library, so that the system can ensure that the separator used meets the predefined specifications, thereby generating a date and time string with high consistency and reliability. This mechanism not only prevents system anomalies caused by users entering incorrect separators, but also enhances the flexibility and scalability of the system to meet the needs of different application scenarios. The fallback mechanism further ensures the robustness of the system. Even if the user enters an invalid separator, the system can still operate normally and prompt the user to correct the error.

[0130] Furthermore, a fourth embodiment of the method for standardizing date and time of the present invention is proposed. In the above S10, the definition of separator parameters includes:

[0131] S104, constructing a locale parameter database including time zone information and / or system language setting information, and establishing a time zone language mapping table;

[0132] S105, obtaining the current time zone information and system language setting information of the front-end interface, searching for matching locale parameters in the locale parameter database according to the order of complete match, time zone information match and system language setting information match, and obtaining the current locale parameters;

[0133] S106: Select a separator parameter that matches the current locale parameter from the time zone language mapping table.

[0134] In this embodiment, the locale parameter database refers to a database containing time zone information and system language setting information of different regions (locales), which is used to select appropriate separators when generating date and time formats. The time zone language mapping table is a mapping table that associates different time zones and language settings with corresponding separator parameters. The system uses this mapping table to select appropriate separator parameters for different users. The system first tries to find a locale parameter in the locale parameter database that completely matches the user's time zone information and system language setting information. If no completely matching item is found, the system will match according to the time zone information or system language setting information in turn until the most suitable separator parameter is found.

[0135] In one specific implementation, the system first builds a locale parameter database containing time zone information and system language setting information, and establishes a time zone language mapping table. For example, the user's current time zone is UTC+1, and the system language setting is English (en-US). The system first searches the locale parameter database for a locale parameter that fully matches the user's time zone and language setting (such as en-US corresponding to UTC+1). If a fully matching parameter is found, the system directly selects the corresponding separator parameter (such as / ) from the mapping table and applies it to the generation of the date and time string.

[0136] In another specific implementation, if the system fails to find a locale parameter that fully matches the user's time zone and language settings, the system will match based on the user's time zone information. For example, the user's time zone is UTC+2, and the system language setting is German (de-DE). If no fully matching de-DE corresponding to UTC+2 is found in the locale parameter database, the system will match based on the UTC+2 time zone, select the closest locale parameter (such as a German regional setting that conforms to UTC+2), and select a suitable separator parameter (such as.) from the time zone language mapping table to ensure that the generated date and time string conforms to the user's time zone habits.

[0137] In another specific implementation, if the user's time zone information does not have a corresponding match in the locale parameter database, the system will select a suitable separator based on the user's system language setting. For example, if the user's time zone is UTC-5, but the system language setting is Spanish (es-ES), the system will match according to es-ES and select a suitable separator parameter (such as -) from the mapping table to generate the date and time string. This method ensures that even if the time zone information cannot be matched, the system can provide a date and time format that conforms to the user's language habits through the language setting.

[0138] In another specific implementation, in order to cope with changes in globalization needs, the system may need to regularly update the locale parameter database and time zone language mapping table. For example, when new language settings or time zone information are introduced, the administrator can update the database and mapping table so that the system can provide more users with accurately matched separator parameters. This ensures that the system can generate date and time strings that conform to local customs in applications around the world.

[0139] Example description:

[0140] In a global software development project, different development teams may be located in different time zones and use different system language settings. In order to unify the date and time format, the system needs to select the appropriate separator based on the user's time zone information and language settings. Suppose a developer's time zone is UTC+1 and the system language is set to English (en-US). The system will first search for locale parameters that exactly match this time zone and language settings in the constructed locale parameter database. If an exact match is found (such as en-US for UTC+1), the system will select the corresponding separator (such as / ) from the time zone language mapping table and apply it to the generated date and time string.

[0141] This embodiment constructs a local parameter database and a time zone language mapping table, and matches according to the order of complete matching, time zone information matching, and system language setting information matching, so that the system can dynamically select appropriate separator parameters. This mechanism ensures that the generated date and time string conforms to the habits of the user's region and can flexibly respond to different international requirements. The dynamic update capability of the system further enhances its adaptability, and can adjust in time to adapt to changes around the world, maintaining consistency and standardization of data processing.

[0142] Furthermore, a fifth embodiment of the method for standardizing date and time of the present invention is proposed. The above S30 includes:

[0143] S301, splitting the date into date characters according to year, month and day, and splitting the time into time characters according to hour, minute and second;

[0144] S302, adding a character 0 before the date character and time character that are less than 10, and keeping the characters in other date characters and other time characters unchanged;

[0145] S303, using the separator parameter to concatenate all date characters and time characters in the order of year, month, date, hour, minute and second, inserting the separator between the date characters and the time characters to obtain the standardized date and time character string.

[0146] In this embodiment, the system first splits the acquired date and time information into their respective character parts, the date part includes year, month and date, and the time part includes hour, minute and second. In order to ensure the uniform format of date and time, the system performs pre-filling on date characters and time characters less than 10, that is, adds a character 0 in front of them, while other characters greater than or equal to 10 remain unchanged. The system uses the previously defined separator parameters to splice the split date characters and time characters in the order of year, month, date, hour, minute and second, and inserts the separator between the date characters and the time characters to generate a date and time string that meets the standard.

[0147] In one specific implementation, in a development project, the system needs to generate a standardized date and time string and ensure that all date and time parts are in a unified format. For example, the date obtained is August 5, 2024, and the time is 7:4:9. First, the system splits the date into year 2024, month 08, day 05, and the time into hour 07, minute 04, second 09. Then, these parts are concatenated using the standard separator -, and the generated standardized date and time string is 2024-08-05-07-04-09.

[0148] In another specific implementation, in another project, the user wants to use a slash / as a separator for the date part and a colon : as a separator for the time part, with a space between the date and time. For example, the system obtains a date of December 1, 2024, and a time of 9:5:2. The system first pre-fills the date and time parts, changing the date to 2024 / 12 / 01 and the time to 09:05:02. Then, the separator parameters are used for concatenation, and the generated date and time string is 2024 / 12 / 01 09:05:02.

[0149] In another specific implementation, in some embedded or low-resource environments, developers may need to generate a compact date and time string without pre-filling. For example, the date is February 7, 2024, and the time is 3:9:8. The system directly uses the user-specified separator - for concatenation, and the generated date and time string is 2024-2-7 3-9-8. This format helps save storage space.

[0150] In another specific implementation, in an international application, the system automatically selects separators according to the user's time zone and language settings, and generates a date and time string. For example, the user is in the UTC+9 time zone and the language used is Japanese ja-JP. The system first fills in the date and time parts, such as the date November 3, 2024, and the time 5:7:2, which becomes November 03, 2024 and 05:07:02 after filling. Then, using the separator parameters year-month-day hour: minute: second, the final generated date and time string is 2024-November-03 05 hours: 07 minutes: 02 seconds, which conforms to the reading habits of Japanese users.

[0151] Example description:

[0152] In a development environment that requires a high degree of customization, the user wants to use slash / as the separator for the date part, colon : as the separator for the time part, and a space between the date and time. The system obtains the date as December 1, 2024, and the time as 9:5:2. The system first pre-fills the date and time parts, formatting the date as 2024 / 12 / 01 and the time as 09:05:02. The system then concatenates these parts into 2024 / 12 / 0109:05:02 using the user-specified separator, ensuring that the format meets the user's needs for generating reports or logging.

[0153] This embodiment can generate a standardized date and time string by splitting and filling the characters of the date and time parts and splicing them with defined separators, ensuring its consistency and standardization in different application scenarios. Different implementation methods are suitable for different development needs, such as using standard separators, custom separators or compact formats, which further improves the flexibility and adaptability of the system. At the same time, the dynamic splicing function combined with time zone and language settings ensures the performance of the system in international applications and meets the diverse needs of global users.

[0154] Furthermore, a sixth embodiment of the method for standardizing date and time of the present invention is proposed, wherein the above S30 includes:

[0155] S304, the separator parameter is a parameter of a formatting template, which is used to define the output format of the date character and the time character, and the separator parameter is parsed to identify the date element and the time element corresponding to each part in the formatting template and the separator between the elements;

[0156] S305, matching the current date character string and the current time character string with the date element and the time element in the formatting template, adding separators between the elements to the date character string and the time character string, and obtaining a standardized date and time character string that complies with the output format.

[0157] In this embodiment, the date and time strings are combined according to predefined format rules using the separator parameter containing the formatting template to generate a standardized date and time string. The system parses the formatting template in the separator parameter, identifies the date elements and time elements corresponding to each part, and identifies the type of separator between these elements. The system matches the currently acquired date string and time string with the date and time elements in the formatting template, and inserts the corresponding separator between the elements according to the rules in the template, and finally generates a standardized date and time string that conforms to the output format.

[0158] In one specific implementation, a standard formatting template is used for splicing:

[0159] The system needs to generate a date and time string that complies with the ISO 8601 standard. Assume that the system's formatting template is YYYY-MM-DDTHH:MM:SS, which means that the date and time are separated by the T character, the date part uses a hyphen -, and the time part uses a colon:. The current date obtained by the system is August 16, 2024, and the time is 14:30:00. The system first parses the template, matches the date string 2024-08-16 with the time string 14:30:00, and inserts the separator according to the instructions of the template. The final generated date and time string is 2024-08-16T14:30:00.

[0160] In another specific implementation, the user defines a formatting template:

[0161] In a customized system, the user wants to generate a date and time in a compact format, but still maintain a certain readability. The formatting template set by the user is YYYY / MM / DD HH|MM|SS, which means that the date part is separated by a slash / , the time part is separated by a vertical bar |, and the date and time are separated by a space. The current date obtained by the system is December 5, 2024, and the time is 9:8:7. After the system parses the template, it matches the date and time according to the template rules and inserts the separator. The final generated date and time string is 2024 / 12 / 05 09|08|07, which meets the user's specific needs.

[0162] In other embodiments, a template is dynamically formatted based on a locale:

[0163] In an internationalized application, the system needs to select an appropriate formatting template based on the user's regional settings. For example, for Japanese users, the system uses the formatting template YYYY-MM-DD-D-HH-MM-SS-S, with the year, month, and day Chinese characters as separators for the date part and the hour, minute, and second Chinese characters as separators for the time part. The current date obtained by the system is November 3, 2024, and the time is 5:7:9. By parsing the template and matching the date and time characters, the final generated date and time string is November 03, 2024, 05:07:09, which conforms to the reading habits and cultural norms of Japanese users.

[0164] In other specific implementations, the system may need to process complex formatting templates and require adjustments to the order of date and time elements. For example, the formatting template set by the user is DD.MM.YYYY-SS:MM:HH, which means that the date part is separated by a period., and the time part is arranged in reverse order and separated by a colon:. The current date obtained by the system is June 12, 2024, and the time is 14:45:30. After the system parses the template, it adjusts the date part to 12.06.2024 and the time part to 30:45:14 in reverse order. The final generated date and time string is 12.06.2024-30:45:14, which meets the user's specific format requirements.

[0165] Example description:

[0166] In a financial application, the user needs to generate a date and time string in a specific format for display in a report. The formatting template specified by the user is YYYY / MM / DD HH|MM|SS, which means that the date part is separated by a slash / , the time part is separated by a vertical bar |, and a space is used between the date and time. The current date obtained by the system is December 5, 2024, and the time is 9:8:7. After parsing the template, the system formats the date as 2024 / 12 / 05 and the time as 09|08|07, and then concatenates the two. The final generated date and time string is 2024 / 12 / 05 09|08|07, which meets the user's personalized display needs.

[0167] By using the separator parameter containing the formatting template, the system can flexibly process and generate standardized date and time strings that meet diverse needs. Whether using a standard format, a customized format, or dynamically adjusting the format according to the locale, the system can accurately parse the template and generate an output format that meets the expected requirements. This mechanism not only improves the flexibility and adaptability of the system, but also ensures the consistency and standardization of the generated date and time strings in different environments.

[0168] Furthermore, a seventh embodiment of the method for standardizing date and time of the present invention is proposed. In the above S30, after obtaining the standardized date and time character string, the method further includes:

[0169] S40, receiving an output type parameter sent by a user, and identifying content of the output type parameter;

[0170] S50, if the value of the output type parameter is string, directly return the standardized date and time string to the user;

[0171] S60, if the value of the output type parameter is json, split the standardized date and time string into a date part and a time part, convert the date part and the time part into a string of JSON type and return it to the user;

[0172] S70: If the value of the output type parameter is object, parse the standardized date and time string, encapsulate the date element and time element therein into an object or a data structure and return it to the user.

[0173] In this embodiment, the output type parameter is a parameter specified by the user, indicating how the system should return a standardized date and time string. Different values ​​correspond to different output formats.

[0174] Processing of different formats:

[0175] string: If the value of the output type parameter is string, the system directly returns the standardized date and time string without additional processing.

[0176] json: If the value of the output type parameter is json, the system splits the standardized date and time string into the date part and the time part, converts it into a string in JSON format and returns it to the user.

[0177] object: If the value of the output type parameter is object, the system parses the standardized date and time string into specific date elements and time elements, encapsulates these elements into objects or data structures, and returns them to the user.

[0178] In one specific implementation, the system needs to return the date and time to the user in a simple and direct way so that it can be displayed on the interface or used for logging. The user specifies the output type parameter as string in the request. After the system recognizes the parameter, it directly returns the standardized date and time string (such as 2024-08-16T14:30:00) to the user. This method is suitable for data output scenarios that require high efficiency and no additional processing, such as directly inserting the date and time into a database record or front-end display.

[0179] In another specific implementation, the user wants to return date and time information in the form of an object or data structure for further calculation and operation in the application. The user specifies the output type parameter as object in the request. After the system recognizes the parameter, it parses the standardized date and time string (such as 2024-08-16T14:30:00) into its components: year, month, day, hour, minute, and second. The system then encapsulates these parts into an object or data structure with fields such as year, month, day, hour, minute, second, and returns the object to the user for direct call and operation in the programming environment.

[0180] In other specific implementations, the user may need to obtain date and time information in multiple formats at the same time. For example, the user needs a JSON object, but the date and time part contained therein remains in string format. The user specifies the output type parameter as json-string in the request. After the system recognizes the parameter, it encapsulates the standardized date and time string (such as 2024-08-16T14:30:00) into a JSON object and returns it as a string field, for example {"datetime":"2024-08-16T14:30:00"}.

[0181] Example description:

[0182] In a multifunctional application system, users may need to obtain date and time information in multiple formats at the same time. For example, the user wants to return an object containing JSON format while retaining the original string format. In this case, the user specifies the output type parameter as json-string in the request. After the system recognizes the parameter, it encapsulates the date and time string (such as 2024-08-16T14:30:00) into a JSON object, such as {"datetime":"2024-08-16T14:30:00"}, and returns it to the user. In this way, users can obtain structured data and original string data at the same time.

[0183] This embodiment receives the output type parameter specified by the user and processes it accordingly, so that the system can flexibly meet the user's different requirements for date and time strings. Whether it is directly returning a string, converting it to JSON format, or encapsulating it as an object, the system can adjust it according to the user's requirements. This mechanism not only improves the flexibility and adaptability of the system, but also enables date and time data to be effectively applied and processed in different usage scenarios, enhancing user experience and data processing efficiency.

[0184] It should be noted that there is not necessarily a certain order between the above-mentioned steps. A person skilled in the art can understand, based on the description of the embodiments of the present invention, that in different embodiments, the above-mentioned steps may have different execution orders, that is, they may be executed in parallel, may be executed interchangeably, and so on.

[0185] The invention also provides a device for standardizing processing of date and time.

[0186] Reference Figure 2 , Figure 2 This is a functional module diagram of the first embodiment of the date and time standardization processing device of the present invention. The date and time standardization processing device comprises:

[0187] A separator definition module is used to define separator parameters, where the separator parameters are used to determine separators in a date character string and a time character string;

[0188] The date and time acquisition module acquires the current date and time in the front-end interface to form a current date string and a current time string. The date includes year, month and day, and the time includes hours, minutes and seconds.

[0189] The standardization processing module uses the separator parameter to concatenate the current date character string and the current time character string, and adds the separator to the current date character string and the current time character string to obtain a standardized date and time character string.

[0190] In addition, an embodiment of the present invention further provides a computer storage medium.

[0191] The computer storage medium stores a date and time standardization processing program, which implements the steps of the date and time standardization processing method described above when executed by the processor.

[0192] The specific implementation of the storage medium of the present invention is basically the same as the embodiments of the above-mentioned method for standardizing date and time, and will not be described in detail here.

[0193] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims. All equivalent structures or equivalent process changes made using the contents of the specification and drawings of the present invention, or directly or indirectly used in other related technical fields, are protected by the present invention.

[0194] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0195] In addition, each functional module in each embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part. If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk.

[0196] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0197] The above are only various implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for standardizing date and time, characterized in that: include: Define a separator parameter, which is used to determine the separator in the date string and the time string; Get the current date and time in the front-end interface to form a current date string and a current time string, where the date includes year, month and day, and the time includes hours, minutes and seconds; The current date character string and the current time character string are concatenated using the separator parameter, and the separator is added to the current date character string and the current time character string to obtain a standardized date and time character string.

2. The method for standardizing date and time according to claim 1, wherein: The definition of delimiter parameters includes: Define a parameter variable of string type to determine whether the user-specified separator is received; If so, storing the user-specified separator into the parameter variable to obtain the separator parameter; If not, a default separator is set in the parameter variable to obtain the separator parameter.

3. The method for standardizing date and time as claimed in claim 2, characterized in that: The step of storing the user-specified separator in the parameter variable to obtain the separator parameter includes: Matching the user-specified delimiter with a standard delimiter library to determine whether the user-specified delimiter meets the standard; If so, storing the user-specified separator into the parameter variable to obtain the separator parameter; If not, the default delimiter is stored in the parameter variable, the delimiter parameter is obtained, and the user is prompted that the specified delimiter input does not meet the standard or is an invalid delimiter.

4. The method for standardizing date and time as claimed in claim 1, characterized in that: The definition of delimiter parameters includes: Build a locale parameter database containing time zone information and / or system language setting information, and establish a time zone language mapping table; Obtain the current time zone information and system language setting information of the front-end interface, search for matching locale parameters in the locale parameter database according to the order of complete match, time zone information match and system language setting information match, and obtain the current locale parameters; A separator parameter matching the current locale parameter is selected from the time zone language mapping table.

5. The method for standardizing date and time according to claim 1, wherein: The step of concatenating the current date character string and the current time character string using the separator parameter, adding the separator to the current date character string and the current time character string, and obtaining a standardized date and time character string includes: Split the date into date characters according to year, month and day, and split the time into time characters according to hour, minute and second; Add a character 0 before the date character and time character that is less than 10, and keep the characters in other date characters and other time characters unchanged; All date characters and time characters are concatenated using the separator parameter in the order of year, month, date, hour, minute and second, and the separator is inserted between the date characters and the time characters to obtain the standardized date and time character string.

6. The method for standardizing date and time according to claim 1, wherein: The step of concatenating the current date character string and the current time character string using the separator parameter, adding the separator to the current date character string and the current time character string, and obtaining a standardized date and time character string includes: The separator parameter is a parameter of the formatting template, which is used to define the output format of the date character and the time character, and the separator parameter is parsed to identify the date element and time element corresponding to each part of the formatting template and the separator between the elements; The current date character string and the current time character string are matched with the date element and the time element in the formatting template, and separators between the elements are added to the date character string and the time character string to obtain a standardized date and time character string that conforms to the output format.

7. The method for standardizing date and time according to claim 1, wherein: After obtaining the standardized date and time string, the following steps are further included: Receiving an output type parameter sent by a user, and identifying content of the output type parameter; If the value of the output type parameter is string, the standardized date and time string is directly returned to the user; If the value of the output type parameter is json, split the standardized date and time string into a date part and a time part, convert the date part and the time part into a string of JSON type and return it to the user; If the value of the output type parameter is object, the standardized date and time string is parsed, and the date element and time element therein are encapsulated as an object or a data structure and returned to the user.

8. A device for standardizing date and time, characterized in that: The date and time standardization processing device comprises: A separator definition module is used to define separator parameters, where the separator parameters are used to determine separators in a date character string and a time character string; The date and time acquisition module acquires the current date and time in the front-end interface to form a current date string and a current time string. The date includes year, month and day, and the time includes hours, minutes and seconds. The standardization processing module uses the separator parameter to concatenate the current date character string and the current time character string, and adds the separator to the current date character string and the current time character string to obtain a standardized date and time character string.

9. A device for standardizing date and time, characterized in that: The date and time standardization processing device includes a memory, a processor, and a date and time standardization processing program stored in the memory and executable on the processor. When the date and time standardization processing program is executed by the processor, the steps of the date and time standardization processing method as described in any one of claims 1 to 7 are implemented.

10. A computer storage medium, characterized in that: The storage medium stores a date and time standardization processing program, and when the date and time standardization processing program is executed by the processor, the steps of the date and time standardization processing method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Artificial intelligence system for data standardization

    CN119648389A