CN110059302A - Data Date formatting method, device, equipment and readable storage medium storing program for executing - Google Patents

Data Date formatting method, device, equipment and readable storage medium storing program for executing Download PDF

Info

Publication number
CN110059302A
CN110059302A CN201910201535.8A CN201910201535A CN110059302A CN 110059302 A CN110059302 A CN 110059302A CN 201910201535 A CN201910201535 A CN 201910201535A CN 110059302 A CN110059302 A CN 110059302A
Authority
CN
China
Prior art keywords
format
date
target
dictionary
data
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.)
Pending
Application number
CN201910201535.8A
Other languages
Chinese (zh)
Inventor
黄亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Urban Construction Technology Shenzhen Co Ltd
Original Assignee
Ping An Urban Construction Technology Shenzhen Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Ping An Urban Construction Technology Shenzhen Co Ltd filed Critical Ping An Urban Construction Technology Shenzhen Co Ltd
Priority to CN201910201535.8A priority Critical patent/CN110059302A/en
Publication of CN110059302A publication Critical patent/CN110059302A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/106Display of layout of documents; Previewing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/111Mathematical or scientific formatting; Subscripts; Superscripts
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • G06F40/157Transformation using dictionaries or tables

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Algebra (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of Data Date formatting method, device, equipment and readable storage medium storing program for executing, which comprises when detecting date formatization instruction, is obtained based on date formatization instruction to format data and target date format;Judge the target date format whether is prestored in preset format dictionary;If prestoring the target date format in preset format dictionary, the target date format in the preset format dictionary is called, to carry out date format conversion process to format data to described, and obtains the first transformation result.When the present invention solves existing formattings processing date-time, the technical issues of frequent transitions between different-format will lead to App Caton, reduction user experience.

Description

Data Date formatting method, device, equipment and readable storage medium storing program for executing
Technical field
The present invention relates to field of computer technology more particularly to a kind of Data Date formatting method, device, equipment and can Read storage medium.
Background technique
Currently, Objective-C language is usually needed using DateFormatter class (i.e. date format class) date created Format, to format processing date-time, wherein format processing date-time and generally refer to the time format that will acquire At the exhibition method of needs.
However, the phenomenon that being currently, there are date created format excessive using date format class, the excessive creation of date format Cause to apply and needs the frequent transitions between NSDate format (operation format) and NSString format (storage format), and Frequent transitions between NSDate format and NSString format will lead to App (computer applied algorithm) Caton, reduce use Family experience.
Summary of the invention
The main purpose of the present invention is to provide a kind of Data Date formatting method, device, equipment and readable storage mediums Matter, it is intended to which when solving existing formatting processing date-time, the frequent transitions between different-format will lead to App Caton, reduce The technical issues of user experience.
To achieve the above object, the present invention provides a kind of Data Date formatting method, the Data Date formatting side Method includes:
When detecting date formatization instruction, obtained based on date formatization instruction to format data and mesh Mark date format;
Judge the target date format whether is prestored in preset format dictionary;
If prestoring the target date format in preset format dictionary, the mesh in the preset format dictionary is called Date format is marked, to carry out date format conversion process to format data to described, and obtains the first transformation result.
Optionally, described to judge that the target date format step whether is prestored in preset format dictionary includes:
Obtain the introduction time format parameter of target date format, localized area parameter in the date formatization instruction And time zone parameter;
First object key assignments is determined according to the introduction time format parameter, localized area parameter and time zone parameter;
The each key assignments prestored in the first object key assignments and preset format dictionary is compared, and obtains comparison knot Fruit;
The target date format whether is prestored in preset format dictionary according to comparison result determination, wherein When comparison result is there is key assignments identical with first object key assignments in preset format dictionary, determine in preset format dictionary Prestore the target date format.
Optionally, there are mapping relations one by one in key assignments and date format;
Whether the judgement, which is prestored in preset format dictionary after the target date format step, includes:
If not prestoring the target date format in preset format dictionary, by the introduction time format parameter, Localized area parameter and time zone parameter are with the unique key assignments of character style splicing generation;
Using unique key assignments of the generation as the second target key value, reflected one by one according to second target key value with described The relationship of penetrating obtains the date formatization and instructs corresponding determining date format;
Date format conversion process is carried out to format data to described according to the determining date format, and obtains second Transformation result;
Using second transformation result, second target key value and the determining date format as newly-increased date lattice The newly-increased date format is added in the preset format dictionary by formula.
Optionally, if described judge to wrap after whether prestoring the target date format step in preset format dictionary It includes:
If prestoring the target date format in preset format dictionary, judge that the target date format is currently It is no to be in locking state, wherein if the target date format is called, the target date format is in locking state;
If the target date format is currently at locking state, obtain the target date format when locking Between, according to the processing mode for determining the date formatization instruction to lock times.
Optionally, if the target date format is currently at locking state, the target date format is obtained To lock times, include: according to the processing mode step for determining the date formatization instruction to lock times
If the target date format is currently at locking state, obtain the target date format when locking Between;
The judgement generation time for whether being greater than date format to lock times, if described be greater than the date to lock times The generation time of format, it is determined that the processing mode of the date formatization instruction is the first processing mode, in the first processing side In formula, the determining date format is generated to carry out the processing of the date formatization instruction;
If the generation time for being less than date format to lock times, it is determined that the processing of the date formatization instruction Mode is second processing mode, in second processing mode, calls the determining date format to carry out the date format The processing of instruction.
Optionally, if the generation time for being greater than date format to lock times, it is determined that the date format The processing mode for changing instruction is that the first processing mode step includes: later
The processing of key assignments duplicate checking is carried out to the preset format dictionary at interval of preset time period;
If corresponding to phase to the identical key assignments, the identical key assignments there are when identical key assignments in the preset format dictionary Same date format carries out unique reservation process.
The present invention also provides a kind of Data Date formatting mechanism, the Data Date formatting mechanism includes:
First obtains module, for being obtained based on date formatization instruction when detecting date formatization instruction To format data and target date format;
First judgment module, for judging whether prestore the target date format in preset format dictionary;
Calling module, if being called described default for prestoring the target date format in preset format dictionary Target date format in format dictionary to carry out date format conversion process to format data to described, and obtains first Transformation result.
Optionally, the first judgment module includes:
First acquisition unit, for obtaining the introduction time format ginseng of target date format in the date formatization instruction Number, localized area parameter and time zone parameter;
First determination unit, for according to the introduction time format parameter, localized area parameter and time zone parameter Determine first object key assignments;
Comparing unit, for comparing each key assignments prestored in the first object key assignments and preset format dictionary It is right, and obtain comparison result;
Second determination unit, for whether prestoring the mesh in preset format dictionary according to comparison result determination Mark date format, wherein when comparison result is there is key assignments identical with first object key assignments in preset format dictionary, determine The target date format is prestored in preset format dictionary.
Optionally, there are mapping relations one by one in key assignments and date format;
The Data Date formatting mechanism further include:
Generation module, if for not prestoring the target date format in preset format dictionary, it will be described incoming Time format parameter, localized area parameter and time zone parameter generate unique key assignments with character style splicing;
Second obtains module, for using unique key assignments of the generation as the second target key value, according to second mesh Mark key assignments and the mapping relations one by one obtain the corresponding determining date format of the date formatization instruction;
Conversion processing module, for carrying out date format turn to format data to described according to the determining date format Processing is changed, and obtains the second transformation result;
Determining module is used for second transformation result, second target key value and the determining date format As newly-increased date format, the newly-increased date format is added in the preset format dictionary.
Optionally, the Data Date formatting mechanism further include:
Second judgment module, if for prestoring the target date format in preset format dictionary, described in judgement Whether target date format is currently in locking state, wherein if the target date format is called, the target date Format is in locking state;
Third obtains module and obtains the target day if being currently at locking state for the target date format Phase format to lock times, according to the processing mode for determining the date formatization instruction to lock times.
Optionally, the third acquisition module includes:
Second acquisition unit obtains the target day if being currently at locking state for the target date format Phase format to lock times;
Judging unit, for judging the generation time for whether being greater than date format to lock times, if described to be added Lock generation time of the time greater than date format, it is determined that the processing mode of the date formatization instruction is the first processing side Formula generates the determining date format in the first processing mode to carry out the processing of the date formatization instruction;
Third determination unit, if for the generation time for being less than date format to lock times, it is determined that the day The processing mode of phase formatting commands is second processing mode, in second processing mode, call the determining date format with Carry out the processing of the date formatization instruction.
Optionally, the third obtains module further include:
Duplicate checking unit, for carrying out the processing of key assignments duplicate checking to the preset format dictionary at interval of preset time period;
Reservation process unit, if in the preset format dictionary there are when identical key assignments, to the identical key assignments, institute It states identical key assignments and corresponds to the unique reservation process of identical date format progress.
In addition, to achieve the above object, the present invention also provides a kind of Data Date format device, the Data Date lattice Formula equipment includes: memory, processor, and communication bus and the Data Date being stored on the memory format journey Sequence,
The communication bus is for realizing the communication connection between processor and memory;
The processor is for executing the Data Date formatted program, to perform the steps of
When detecting date formatization instruction, obtained based on date formatization instruction to format data and mesh Mark date format;
Judge the target date format whether is prestored in preset format dictionary;
If prestoring the target date format in preset format dictionary, the mesh in the preset format dictionary is called Date format is marked, to carry out date format conversion process to format data to described, and obtains the first transformation result.
In addition, to achieve the above object, the present invention also provides a kind of readable storage medium storing program for executing, the readable storage medium storing program for executing storage Have one perhaps more than one program the one or more programs can be held by one or more than one processor Row is to be used for:
When detecting date formatization instruction, obtained based on date formatization instruction to format data and mesh Mark date format;
Judge the target date format whether is prestored in preset format dictionary;
If prestoring the target date format in preset format dictionary, the mesh in the preset format dictionary is called Date format is marked, to carry out date format conversion process to format data to described, and obtains the first transformation result.
The present invention based on date formatization instruction by being obtained wait format when detecting date formatization instruction Data and target date format;Judge the target date format whether is prestored in preset format dictionary;If default The target date format is prestored in format dictionary, then the target date format in the preset format dictionary is called, with right It is described to carry out date format conversion process to format data, and obtain the first transformation result.In this application, day is being detected When phase formatting commands, first carry out the inquiry of the target date format prestored in preset format dictionary, then judge again be It is no to need to create new date format, that is, in this application, if prestoring the target date lattice in preset format dictionary Formula then calls the target date format in the preset format dictionary, without all carrying out the date to every date formatization instruction The creation of format, thus, reduce the NSDate formats (operation format) of more numbers caused by the creation because of date format with It is converted between NSString format (storage format), reduces App Caton, thus, the application solves existing formatting and handles day The technical issues of when time phase, the frequent transitions between different-format will lead to App Caton, reduce user experience.
Detailed description of the invention
Fig. 1 is the flow diagram of Data Date formatting method first embodiment of the present invention;
Fig. 2 is to judge the target whether is prestored in preset format dictionary in Data Date formatting method of the present invention The refinement flow diagram of date format step;
Fig. 3 is the device structure schematic diagram for the hardware running environment that present invention method is related to.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The present invention provides a kind of Data Date formatting method, and first in Data Date formatting method of the present invention is implemented In example, referring to Fig.1, the Data Date formatting method includes:
Step S10 obtains number to be formatted when detecting date formatization instruction, based on date formatization instruction Accordingly and target date format;
Step S20 judges the target date format whether is prestored in preset format dictionary;
Step S30 calls the preset format word if prestoring the target date format in preset format dictionary Target date format in allusion quotation to carry out date format conversion process to format data to described, and obtains the first Change-over knot Fruit.
Specific step is as follows:
Step S10 obtains number to be formatted based on date formatization instruction when detecting date formatization instruction Accordingly and target date format;
In application operation perhaps debugging process namely in application code execution or treatment process, thing is often referred to After the date-time of part (perhaps data) is handled for example, deleting or changing certain line code data every time, need to be modified thing The record of part needs to record the time of change, the record of the time of the change is related at date-time in change record Reason.
For date-time, there are two kinds of formats, one is NSDate date format (operation format), one is NSString date format (storage format), wherein corresponding time format is all when event or data save in system NSString date format, namely since NSDate date format is (it should be noted that NSDate date format is computer capacity Enough identify and handle) it is cumbersome, consequently only that when needing to run the event or data, be need to carry out date operation, When the operation of the date-times such as execution, NSDate date format is just used, due to event or data save and operation is difference Date format, thus, using the conversion for usually needing to carry out date format, it should be noted that NSString date format It is the date formats such as on October 19th, 2018 either 2018/10/19, certainly, NSString date format includes but is not limited to Above-mentioned format, as long as and NSString date format is different, it is also different to correspond to NSDate date format, thus, in existing skill In art, the scheme of use is: often detecting once when needing to carry out dat recorder, first carries out the wound of NSString date format It builds, then equally carries out the creation of corresponding NSDate date format, and require to carry out the wound of NSString date format every time It builds, then equally carries out the creation of corresponding NSDate date format, and frequently converted therebetween, will cause APP Caton.
It in the present embodiment, is in order to avoid frequent date created format, and further for avoiding APP from existing Frequent transitions between NSString date format and NSDate date format and caused by Caton.
In order to avoid frequent date created format, in the present embodiment, a variable dictionary is created NSMutableDictionary namely preset format dictionary are cached with all types of date lattice in the preset format dictionary Formula, that is, in the application, after one date format of every creation, which is cached in preset format dictionary, creation is pre- If the purpose of format dictionary is to avoid the repetition of date format to create, it should be noted that in each preset format dictionary Date format is corresponding to have a unique identifier, which can also wrap other than key assignments key for key assignments key Include value content, wherein value content is date format content, which is a singleton pattern, at this In singleton pattern, including the content that NSString date format indicates, and the content that corresponding NSDate date format indicates.? The purpose that singleton pattern is prestored in preset format dictionary is: convenient for different date contents but the data of same date format Processing.
When detecting date formatization instruction, obtained based on date formatization instruction to format data and mesh Mark date format, wherein date formatization instruction can be automatic trigger and be also possible to artificially to trigger, to format data Refer to needing to add the data of date-time mark, target date format refers to using setting or corresponding eventually in application Hold set-up date format, it should be noted that if date formatization instruction determines that target date format determines, namely Target date format is carried in date formatization instruction.
Step S20 judges the target date format whether is prestored in preset format dictionary;
In the present embodiment, judge the target date format whether is prestored in preset format dictionary, it is pre- in judgement If before whether prestoring the target date format in format dictionary, needing to judge in preset format dictionary whether to be empty, if Determine to be empty in preset format dictionary, then no longer carries out whether prestoring sentencing for the target date format in preset format dictionary It is disconnected, to save process, judge that it includes a variety of judgment modes that the target date format whether is prestored in preset format dictionary, One of judgment mode are as follows: by preset format dictionary exact date format content and target date format particular content into Row compares.
Wherein, referring to Fig. 2, whether the judgement prestores the target date format step also in preset format dictionary Include:
Step S21 obtains the introduction time format parameter of target date format, localization in the date formatization instruction Region parameter and time zone parameter;
In the present embodiment, there are mapping relations one by one in target date format and key assignments, by the comparison of key assignments rather than The comparison of target date format, to reduce the consuming of comparison process resource, wherein key assignments is by introduction time format parameter, originally What ground region parameter and time zone parameter determined, and introduction time format parameter, localized area parameter and time zone parameter It is carried in instruction.
Step S22 determines the first mesh according to the introduction time format parameter, localized area parameter and time zone parameter Mark key assignments;
The is determined according to introduction time format parameter, localized area parameter and time zone parameter in date formatization instruction One target key value, wherein first object key assignments can be by introduction time format parameter, localized area parameter and time zone parameter It successively connects and composes, and the connection sequencing of introduction time format parameter, localized area parameter and time zone parameter can be with Variation.
The each key assignments prestored in the first object key assignments and preset format dictionary is compared, and obtains by step S23 Take comparison result;
After obtaining first object key assignments, each key assignments for will prestoring in the first object key assignments and preset format dictionary Be compared, and obtain comparison result, comparison result include prestored in preset format dictionary it is identical with first object key assignments Key assignments identical with first object key assignments is not prestored in key assignments or preset format dictionary.
Whether step S24 prestores the target date lattice according to comparison result determination in preset format dictionary Formula, wherein when comparison result is there is key assignments identical with first object key assignments in preset format dictionary, determine in default lattice The target date format is prestored in formula dictionary.
The target date format whether is prestored in preset format dictionary according to comparison result determination, wherein When comparison result is there is key assignments identical with first object key assignments in preset format dictionary, determine in preset format dictionary The target date format is prestored, when comparison result is not the presence of key identical with first object key assignments in preset format dictionary When value, determination does not prestore the target date format in preset format dictionary.In the present embodiment, it is compared by key assignments true Fixed, realization judges the target date format whether is prestored in preset format dictionary.
Step S30 calls the preset format word if prestoring the target date format in preset format dictionary Target date format in allusion quotation to carry out date format conversion process to format data to described, and obtains the first Change-over knot Fruit.
In the present embodiment, it if prestoring the target date format in preset format dictionary, calls described default Target date format in format dictionary due to calling existing target date format, thus reduces the creation of date format, It converts, reduces between the NSDate format (operation format) and NSString format (storage format) of the more numbers avoided App Caton.
After calling the target date format in the preset format dictionary, formatting number is treated according to target date format According to progress date format conversion process, and the first transformation result is obtained, after obtaining the first transformation result, by the first transformation result It exports and instructs corresponding requesting party to date formatization.
The present invention based on date formatization instruction by being obtained wait format when detecting date formatization instruction Data and target date format;Judge the target date format whether is prestored in preset format dictionary;If default The target date format is prestored in format dictionary, then the target date format in the preset format dictionary is called, with right It is described to carry out date format conversion process to format data, and obtain the first transformation result.In this application, day is being detected When phase formatting commands, first carry out the inquiry of the target date format prestored in preset format dictionary, then judge again be It is no to need to create new date format, that is, in this application, if prestoring the target date lattice in preset format dictionary Formula then calls the target date format in the preset format dictionary, without all carrying out the date to every date formatization instruction The creation of format, thus, reduce the NSDate formats (operation format) of more numbers caused by the creation because of date format with It is converted between NSString format (storage format), reduces App Caton, thus, the application solves existing formatting and handles day The technical issues of when time phase, the frequent transitions between different-format will lead to App Caton, reduce user experience.
Further, the present invention provide Data Date formatting method another embodiment, in this embodiment, key assignments with There are mapping relations one by one in date format;
Whether the judgement, which is prestored in preset format dictionary after the target date format step, includes:
Step S25, if not prestoring the target date format in preset format dictionary, by the introduction time lattice Formula parameter, localized area parameter and time zone parameter generate unique key assignments with character style splicing;
In the present embodiment, to increase fault-tolerance, if not prestoring the target date format in preset format dictionary, The introduction time format parameter, localized area parameter and time zone parameter are spliced with character style then and generate unique key Value, wherein the mode for generating unique key assignments belongs to the prior art, does not illustrate herein.
Step S26, using unique key assignments of the generation as the second target key value, according to second target key value and institute It states mapping relations one by one and obtains the corresponding determining date format of the date formatization instruction;
After obtaining unique key assignments, using unique key assignments of the generation as the second target key value, according to second mesh Mark key assignments and the mapping relations one by one obtain the corresponding determining date format of the date formatization instruction, namely in this implementation In example, unique key assignments is generated every time, and all corresponding generate determines date format, can call same date format for subsequent.
Step S27 carries out date format conversion process to format data to described according to the determining date format, and Obtain the second transformation result;
Step S28, using second transformation result, second target key value and the determining date format as new Increase date format, the newly-increased date format is added in the preset format dictionary.
After generating determining date format, date lattice are carried out to format data to described according to the determining date format Formula conversion process, and the second transformation result is obtained, the second transformation result purpose is obtained in addition to the second transformation result can be exported Instructed outside corresponding requesting party to date formatization, also using the second transformation result as in singleton pattern value content namely A content in newly-increased date format, for calling, specifically, value content further includes the second target key value and described Determine date format.
It in the present embodiment, will be described if by not prestoring the target date format in preset format dictionary Introduction time format parameter, localized area parameter and time zone parameter generate unique key assignments with character style splicing;It will be described The unique key assignments generated obtains described as the second target key value according to second target key value and the mapping relations one by one Date formatization instructs corresponding determining date format;Day is carried out to format data to described according to the determining date format Phase format conversion processing, and obtain the second transformation result;By second transformation result, second target key value and described Determine that as newly-increased date format, the newly-increased date format is added in the preset format dictionary for date format.Due to In the present embodiment, newly-increased date format is added in preset format dictionary, thus, it is possible to further avoid reducing day The creation of phase format, NSDate format (operation format) and NSString format (storage format) of the more numbers avoided Between convert.
Further, the present invention provides another embodiment of Data Date formatting method, in this embodiment, if described Judge whether to prestore in preset format dictionary after the target date format step and includes:
Step A1 judges the target date lattice if prestoring the target date format in preset format dictionary Whether formula is currently in locking state, wherein if the target date format is called, the target date format, which is in, to be added Lock status;
In the present embodiment, it is provided with thread lock either process lock, to avoid multiple request call same date formats, When there are the instruction of multiple date formatizations, is successively sorted to the instruction of multiple date formatization according to the time is generated, be It avoids waiting for a long time and may cause the processing for delaying date formatization instruction, in the present embodiment, if in preset format word The target date format is prestored in allusion quotation, then judges the target date format currently whether in locking state, wherein if The target date format is called, then the target date format is in locking state.
Step A2, if the target date format is currently at locking state, obtain the target date format to Lock times, according to the processing mode for determining the date formatization instruction to lock times.
If the target date format is currently at locking state, carries out the target date format and be currently at locking shape The calculating of the time of state, that is, obtain the target date format to lock times, according to it is described determine to lock times described in The processing mode of date formatization instruction.It should be noted that being instructed to lock times and currently pending date formatization Number it is related.
Wherein, if the target date format is currently at locking state, the target date format is obtained To lock times, include: according to the processing mode step for determining the date formatization instruction to lock times
Step B1, if the target date format is currently at locking state, obtain the target date format to Lock times;
Step B2, the judgement generation time for whether being greater than date format to lock times, if described to lock times Greater than the generation time of date format, it is determined that the processing mode of date formatization instruction is the first processing mode, the In one processing mode, the determining date format is generated to carry out the processing of the date formatization instruction;
If the target date format is currently at locking state, obtain the target date format when locking Between.Wherein, if referring to calling date format to carry out the date lattice according to thread lock either process lock to lock times The processing time of formulaization instruction processing, the judgement generation time for whether being greater than date format to lock times, such as wait lock Time is 0.5S, and the generation time of date format can be 0.4S, or to lock times is 0.4S, when the generation of date format Between can be 0.5S, if the generation time for being greater than date format to lock times, it is determined that date formatization instruction Processing mode be the first processing mode, in the first processing mode, generate the determining date format to carry out the date The processing of formatting commands, i.e., in the first processing mode, selection, which generates, determines date format rather than invocation target date lattice Formula.
Step B3, if the generation time for being less than date format to lock times, it is determined that the date format refers to The processing mode of order is second processing mode, in second processing mode, calls the determining date format to carry out the day The processing of phase formatting commands.
If the generation time for being less than date format to lock times, it is determined that the processing of the date formatization instruction Mode is second processing mode, in second processing mode, calls the determining date format to carry out the date format The processing of instruction namely date formatization instruction are handled by way of invocation target date format.
If the generation time for being greater than date format to lock times, it is determined that the date formatization instruction Processing mode is that the first processing mode step includes: later
Step C1 carries out the processing of key assignments duplicate checking to the preset format dictionary at interval of preset time period;
Due to existing in the first processing mode, the determining date format is generated to carry out the date formatization instruction Processing, i.e., in the first processing mode, selection, which generates, determines date format rather than invocation target date format, thus, can It can lead in preset format dictionary that there are duplicate date formats, in the present embodiment, at interval of preset time period to described pre- If format dictionary carries out the processing of key assignments duplicate checking.The processing of key assignments duplicate checking refers to that duplicate checking is compared by key assignments.
Step C2, if there are when identical key assignments in the preset format dictionary, to the identical key assignments, the identical key assignments Corresponding identical date format carries out unique reservation process.
If corresponding to phase to the identical key assignments, the identical key assignments there are when identical key assignments in the preset format dictionary Same date format carries out unique reservation process, is to delete duplicate date format or value content.
In the present embodiment, if by prestoring the target date format in preset format dictionary, described in judgement Whether target date format is currently in locking state, wherein if the target date format is called, the target date Format is in locking state;If the target date format is currently at locking state, the target date format is obtained To lock times, according to the processing mode for determining the date formatization instruction to lock times.Thus, promote date lattice The treatment effeciency of formulaization instruction.
Referring to Fig. 3, Fig. 3 is the device structure schematic diagram for the hardware running environment that the embodiment of the present invention is related to.
Data Date format device of the embodiment of the present invention can be PC, be also possible to smart phone, tablet computer, electronics (Moving Picture Experts Group Audio Layer III, dynamic image expert compress mark by book reader, MP3 Quasi- audio level 3) player, (Moving Picture Experts Group Audio Layer IV, dynamic image are special by MP4 Family's compression standard audio level 3) terminal devices such as player, portable computer.
As shown in figure 3, the Data Date format device may include: processor 1001, such as CPU, memory 1005, Communication bus 1002.Wherein, communication bus 1002 is for realizing the connection communication between processor 1001 and memory 1005.It deposits Reservoir 1005 can be high speed RAM memory, be also possible to stable memory (non-volatile memory), such as magnetic Disk storage.Memory 1005 optionally can also be the storage equipment independently of aforementioned processor 1001.
Optionally, which can also include target user interface, network interface, camera, RF (Radio Frequency, radio frequency) circuit, sensor, voicefrequency circuit, WiFi module etc..Target user interface may include Display screen (Display), input unit such as keyboard (Keyboard), optional target user interface can also include having for standard Line interface, wireless interface.Network interface optionally may include standard wireline interface and wireless interface (such as WI-FI interface).
It will be understood by those skilled in the art that Data Date format device structure shown in Fig. 3 does not constitute logarithm It may include perhaps combining certain components or not than illustrating more or fewer components according to the restriction of date format equipment Same component layout.
As shown in figure 3, as may include that operating system, network are logical in a kind of memory 1005 of computer storage medium Believe module and Data Date formatted program.Operating system is to manage and control Data Date format device hardware and software The program of resource supports the operation of Data Date formatted program and other softwares and/or program.Network communication module is used for Realize the communication between each component in the inside of memory 1005, and with other hardware and softwares in Data Date format device it Between communicate.
In Data Date format device shown in Fig. 3, processor 1001 is used to execute to store in memory 1005 Data Date formatted program, the step of realizing Data Date formatting method described in any of the above embodiments.
Data Date format device specific embodiment of the present invention and above-mentioned each embodiment of Data Date formatting method Essentially identical, details are not described herein.
The present invention also provides a kind of Data Date formatting mechanism, the Data Date formatting mechanism includes:
First obtains module, for being obtained based on date formatization instruction when detecting date formatization instruction To format data and target date format;
First judgment module, for judging whether prestore the target date format in preset format dictionary;
Calling module, if being called described default for prestoring the target date format in preset format dictionary Target date format in format dictionary to carry out date format conversion process to format data to described, and obtains first Transformation result.
Data Date formatting mechanism specific embodiment of the present invention and above-mentioned each embodiment of Data Date formatting method Essentially identical, details are not described herein.
The present invention provides a kind of readable storage medium storing program for executing, the readable storage medium storing program for executing is stored with one or more than one journey Sequence, the one or more programs can also be executed by one or more than one processor for realizing above-mentioned The step of Data Date formatting method described in one.
Readable storage medium storing program for executing specific embodiment of the present invention and the basic phase of above-mentioned each embodiment of Data Date formatting method Together, details are not described herein.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field similarly includes in patent process range of the invention.

Claims (10)

1. a kind of Data Date formatting method, which is characterized in that the described method includes:
When detecting date formatization instruction, obtained based on date formatization instruction to format data and target day Phase format;
Judge the target date format whether is prestored in preset format dictionary;
If prestoring the target date format in preset format dictionary, the target day in the preset format dictionary is called Phase format to carry out date format conversion process to format data to described, and obtains the first transformation result.
2. Data Date formatting method as described in claim 1, which is characterized in that the judgement is in preset format dictionary Whether prestoring the target date format step includes:
Obtain the introduction time format parameter of target date format in date formatization instruction, localized area parameter and Time zone parameter;
First object key assignments is determined according to the introduction time format parameter, localized area parameter and time zone parameter;
The each key assignments prestored in the first object key assignments and preset format dictionary is compared, and obtains comparison result;
According to the comparison result determination target date format whether is prestored in preset format dictionary, wherein when than It is when there is key assignments identical with first object key assignments in preset format dictionary to result, determination prestores in preset format dictionary There is the target date format.
3. Data Date formatting method as claimed in claim 2, which is characterized in that key assignments exists with date format to be reflected one by one Penetrate relationship;
Whether the judgement, which is prestored in preset format dictionary after the target date format step, includes:
If not prestoring the target date format in preset format dictionary, by the introduction time format parameter, local Change region parameter and time zone parameter and unique key assignments is generated with character style splicing;
Using unique key assignments of the generation as the second target key value, closed according to second target key value and the mapping one by one System obtains the date formatization and instructs corresponding determining date format;
Date format conversion process is carried out to format data to described according to the determining date format, and obtains the second conversion As a result;
Using second transformation result, second target key value and the determining date format as newly-increased date format, The newly-increased date format is added in the preset format dictionary.
4. Data Date formatting method as described in claim 1, which is characterized in that if described judge in preset format dictionary In whether prestore after the target date format step and include:
If prestoring the target date format in preset format dictionary, judge whether the target date format is currently located In locking state, wherein if the target date format is called, the target date format is in locking state;
If the target date format is currently at locking state, obtain the target date format to lock times, root According to the processing mode for determining the date formatization instruction to lock times.
5. Data Date formatting method as claimed in claim 4, which is characterized in that if the target date format is worked as It is preceding to be in locking state, then obtain the target date format to lock times, according to it is described determine to lock times described in Date formatization instruction processing mode step include:
If the target date format is currently at locking state, obtain the target date format to lock times;
The judgement generation time for whether being greater than date format to lock times, if described be greater than date format to lock times The generation time, it is determined that the processing mode of date formatization instruction is the first processing mode, in the first processing mode, The determining date format is generated to carry out the processing of the date formatization instruction;
If the generation time for being less than date format to lock times, it is determined that the processing mode of the date formatization instruction The determining date format is called to carry out the date formatization instruction in second processing mode for second processing mode Processing.
6. Data Date formatting method as claimed in claim 5, which is characterized in that if described be greater than to lock times The generation time of date format, it is determined that the processing mode of the date formatization instruction is packet after the first processing mode step It includes:
The processing of key assignments duplicate checking is carried out to the preset format dictionary at interval of preset time period;
If being corresponded to mutually on the same day there are when identical key assignments to the identical key assignments, the identical key assignments in the preset format dictionary Phase format carries out unique reservation process.
7. a kind of Data Date formatting mechanism, which is characterized in that the Data Date formatting mechanism includes:
First obtains module, for being obtained to lattice based on date formatization instruction when detecting date formatization instruction Formula data and target date format;
First judgment module, for judging whether prestore the target date format in preset format dictionary;
Calling module, if calling the preset format for prestoring the target date format in preset format dictionary Target date format in dictionary to carry out date format conversion process to format data to described, and obtains the first conversion As a result.
8. Data Date formatting mechanism as claimed in claim 7, which is characterized in that the first judgment module includes:
First acquisition unit, for obtain the introduction time format parameter of target date format in date formatization instruction, Localized area parameter and time zone parameter;
First determination unit, for being determined according to the introduction time format parameter, localized area parameter and time zone parameter First object key assignments;
Comparing unit, for each key assignments prestored in the first object key assignments and preset format dictionary to be compared, and Obtain comparison result;
Second determination unit, for whether prestoring the target day in preset format dictionary according to comparison result determination Phase format, wherein when comparison result is there is key assignments identical with first object key assignments in preset format dictionary, determine pre- If prestoring the target date format in format dictionary.
9. a kind of Data Date format device, which is characterized in that the Data Date format device includes: memory, place Device, communication bus and the Data Date formatted program being stored on the memory are managed,
The communication bus is for realizing the communication connection between processor and memory;
The processor is for executing the Data Date formatted program, to realize as described in any one of claims 1 to 6 Data Date formatting method the step of.
10. a kind of readable storage medium storing program for executing, which is characterized in that be stored with Data Date on the readable storage medium storing program for executing and format journey Sequence realizes such as data day of any of claims 1-6 when the Data Date formatted program is executed by processor The step of phase formatting method.
CN201910201535.8A 2019-03-15 2019-03-15 Data Date formatting method, device, equipment and readable storage medium storing program for executing Pending CN110059302A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910201535.8A CN110059302A (en) 2019-03-15 2019-03-15 Data Date formatting method, device, equipment and readable storage medium storing program for executing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910201535.8A CN110059302A (en) 2019-03-15 2019-03-15 Data Date formatting method, device, equipment and readable storage medium storing program for executing

Publications (1)

Publication Number Publication Date
CN110059302A true CN110059302A (en) 2019-07-26

Family

ID=67317061

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910201535.8A Pending CN110059302A (en) 2019-03-15 2019-03-15 Data Date formatting method, device, equipment and readable storage medium storing program for executing

Country Status (1)

Country Link
CN (1) CN110059302A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112434097A (en) * 2020-11-30 2021-03-02 中国建设银行股份有限公司 License time conversion method, device, electronic equipment and medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102651024A (en) * 2012-04-01 2012-08-29 华为技术有限公司 Method and device for data conversion
CN106528505A (en) * 2015-09-14 2017-03-22 北京国双科技有限公司 Date format conversion method and device
CN107122428A (en) * 2017-04-12 2017-09-01 南京南瑞集团公司 A kind of database isomeric data Format Painter conversion method
CN107122296A (en) * 2017-04-18 2017-09-01 上海雷腾软件股份有限公司 The method and apparatus that data for test interface are asserted
CN108733416A (en) * 2017-04-21 2018-11-02 北大方正集团有限公司 Date format processing method based on JavaScript and system
CN108829589A (en) * 2018-05-30 2018-11-16 平安普惠企业管理有限公司 Date data exchange method, device, computer equipment and storage medium
CN109460912A (en) * 2018-10-31 2019-03-12 泰康保险集团股份有限公司 Data processing method, device, storage medium and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102651024A (en) * 2012-04-01 2012-08-29 华为技术有限公司 Method and device for data conversion
CN106528505A (en) * 2015-09-14 2017-03-22 北京国双科技有限公司 Date format conversion method and device
CN107122428A (en) * 2017-04-12 2017-09-01 南京南瑞集团公司 A kind of database isomeric data Format Painter conversion method
CN107122296A (en) * 2017-04-18 2017-09-01 上海雷腾软件股份有限公司 The method and apparatus that data for test interface are asserted
CN108733416A (en) * 2017-04-21 2018-11-02 北大方正集团有限公司 Date format processing method based on JavaScript and system
CN108829589A (en) * 2018-05-30 2018-11-16 平安普惠企业管理有限公司 Date data exchange method, device, computer equipment and storage medium
CN109460912A (en) * 2018-10-31 2019-03-12 泰康保险集团股份有限公司 Data processing method, device, storage medium and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112434097A (en) * 2020-11-30 2021-03-02 中国建设银行股份有限公司 License time conversion method, device, electronic equipment and medium

Similar Documents

Publication Publication Date Title
CN108415739B (en) Hook method and device for dynamic link library function and storage medium
CN110162345B (en) Application program access method and device and storage medium
CN108363528B (en) Application page starting method and device, storage medium and electronic equipment
CN109933760A (en) List generation method, device, computer equipment and computer readable storage medium
US11240290B2 (en) Application download method and apparatus, application sending method and apparatus, and system
US10048986B2 (en) Method and device for allocating browser processes according to a selected browser process mode
CN111427596B (en) Software upgrading method and device and terminal equipment
CN112257135A (en) Model loading method and device based on multithreading, storage medium and terminal
CN109408205A (en) Method for scheduling task and device based on hadoop cluster
US11016769B1 (en) Method and apparatus for processing information
CN106557436A (en) The memory compression function enabled method of terminal and device
CN110175081A (en) A kind of optimization system and its method played for Android audio
CN111104178A (en) Dynamic library loading method, terminal device and storage medium
CN111294377B (en) Dependency network request sending method, terminal device and storage medium
CN106919391B (en) Embedded system of customizable operating system component facing smart phone
CN110059302A (en) Data Date formatting method, device, equipment and readable storage medium storing program for executing
CN111435318A (en) Dex optimization method of application program and terminal
KR102312672B1 (en) Method and Electronic Device for operating screen
CN102843369B (en) The Network Access Method at UI interface and system
CN112380088A (en) Test method and device and electronic equipment
CN104049998A (en) Upgrade package processing method, device and apparatus in Android system
CN110321321A (en) Network control techology snapshot reading/writing method, device, equipment and storage medium
CN113791766B (en) Method for combining data interfaces, electronic device and readable storage medium
CN111915017B (en) Calibration method, device, terminal equipment and storage medium
CN115269517A (en) File management method, device, storage medium and 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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20190726

WD01 Invention patent application deemed withdrawn after publication