How to format date faster than SimpleDateFormat

Hi All,
Can someone tell me way to format the date faster than SimpleDateFormat.
Thanks in advance.
Cheers!!
Puneet

At times when we declare formatter again and again,
the SimpleDateFormat's performance is less as
compared to the apache's FastDateFormat..1) Decaring it wouldn't be what makes it slow. Instantiating it would.
2) As already stated--simply don't instantiate that many of them. Create a few and reuse them.
3) So what if the other one is faster? Have you run into actual problems with SimpleDateFormat being a bottleneck? A Ferrari is faster than my car, but it makes no significant difference for how I use a car. I would not realize any meaningful speed improvement if I had a Ferrari.
4) If the other one is faster and it's that buggerall important, then use the faster one.
. So I was
trying to find out if Sun has something to solve my
problem.You can peruse the API docs as well as anybody else.
I am using the formatting in batch process
so data to process is huge.Have you found a bottleneck? Have you put a profiler on it? Have you determined that it's the parsing that's causing the problems and that creating is negligible?

Similar Messages

  • HOW TO IMPORT DATA MORE THAN ONCE FROM THE SAME EXPORT DUMP FILE?

    before asking my question i'd like to mention that i'm a french spoke...
    so my english is a little bit bad. sorry for that.
    my problem is : IMPORT
    how to import data a SECOND TIME from an export dump file within oracle?
    My Export dump file was made successfully (Full Export) and then i
    tried to import datas for the first time.
    I got this following message in my logfile: I ADDED SOME COMMENTS
    Warning: the objects were exported by L1, not by you
    . importing SYSTEM's objects into SYSTEM
    REM ************** CREATING TABLESPACES *****
    REM *********************************************
    IMP-00015: following statement failed because the object already exists:
    "CREATE TABLESPACE "USER_DATA" DATAFILE 'E:\ORANT\DATABASE\USR1ORCL.ORA' SI"
    "ZE 3145728 DEFAULT STORAGE (INITIAL 10240 NEXT 10240 MINEXTENTS 1 MAX"
    "EXTENTS 121 PCTINCREASE 50) ONLINE PERMANENT"
    IMP-00015: following statement failed because the object already exists:
    "CREATE TABLESPACE "ROLLBACK_DATA" DATAFILE 'E:\ORANT\DATABASE\RBS1ORCL.ORA"
    "' SIZE 10485760 DEFAULT STORAGE (INITIAL 10240 NEXT 10240 MINEXTENTS "
    "1 MAXEXTENTS 121 PCTINCREASE 50) ONLINE PERMANENT"
    etc........
    IMP-00017: following statement failed with ORACLE error 1119:
    "CREATE TABLESPACE "L1" DATAFILE 'E:\ORADATA\L1.DBF' SIZE 1048576000 "
    "DEFAULT STORAGE (INITIAL 10240 NEXT 10240 MINEXTENTS 1 MAXEXTENTS 121 PCTIN"
    "CREASE 50) ONLINE PERMANENT"
    IMP-00003: ORACLE error 1119 encountered
    ORA-01119: error in creating database file 'E:\ORADATA\L1.DBF'
    ORA-09200: sfccf: error creating file
    OSD-04002: unable to open file
    O/S-Error: (OS 3) The system cannot find the path specified
    --->etc..........
    the drive E: with the folder E:\ORADATA didn't exist, but after
    all that i created it.
    see below, before my IMPORT statement
    REM ********************* CREATING USER *********
    REM ********************************************
    IMP-00017: following statement failed with ORACLE error 959:
    "CREATE USER "L1" IDENTIFIED BY VALUES 'A6E0DAA6865E7627' DEFAULT TABLESPACE"
    " "L1" TEMPORARY TABLESPACE "TEMPORARY_DATA""
    IMP-00003: ORACLE error 959 encountered
    ORA-00959: tablespace 'L1' does not exist
    IMP-00017: following statement failed with ORACLE error 959:
    "CREATE USER "MLCO" IDENTIFIED BY VALUES '56AC6447B7D50467' DEFAULT TABLESPA"
    "CE "MLCO" TEMPORARY TABLESPACE "TEMPORARY_DATA""
    IMP-00003: ORACLE error 959 encountered
    ORA-00959: tablespace 'MLCO' does not exist
    ETC.......
    REM ********************* GRANTING ROLES ***********
    REM ************************************************
    IMP-00017: following statement failed with ORACLE error 1917:
    "GRANT ALTER ANY TABLE to "L1" "
    IMP-00003: ORACLE error 1917 encountered
    ORA-01917: user or role 'L1' does not exist
    ETC.........
    IMP-00017: following statement failed with ORACLE error 1918:
    "ALTER USER "L1" DEFAULT ROLE ALL"
    IMP-00003: ORACLE error 1918 encountered
    ORA-01918: user 'L1' does not exist
    -- that is normal, since the creation of the
    tablespace failed !!
    REM******************************
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLLBACK SEGMENT RB_TEMP STORAGE (INITIAL 10240 NEXT 10240 MINEXTENT"
    "S 2 MAXEXTENTS 121) TABLESPACE "SYSTEM""
    IMP-00015: following statement failed because
    . importing SCOTT's objects into SCOTT
    IMP-00015: following statement failed because the object already exists:
    "CREATE SEQUENCE "EVT_PROFILE_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999"
    "999999 INCREMENT BY 1 START WITH 21 CACHE 20 NOORDER NOCYCLE"
    ETC............
    importing L1's objects into L1
    IMP-00017: following statement failed with ORACLE error 1435:
    "ALTER SCHEMA = "L1""
    IMP-00003: ORACLE error 1435 encountered
    ORA-01435: user does not exist
    REM *************** IMPORTING TABLES *******************
    REM ****************************************************
    . importing SYSTEM's objects into SYSTEM
    . . importing table "AN1999_BDAT" 243 rows imported
    . . importing table "BOPD" 112 rows imported
    . . importing table "BOINFO_AP" 49
    ETC................
    . . importing table "BO_WHF" 2 rows imported
    IMP-00015: following statement failed because the object already exists:
    "CREATE TABLE "DEF$_CALL" ("DEFERRED_TRAN_DB" VARCHAR2(128),
    IMP-00015: following statement failed because the object already exists:
    "CREATE SYNONYM "DBA_ROLES" FOR "SYS"."DBA_ROLES""
    IMP-00015: following statement failed because the object already exists:
    "CREATE SYNONYM "DBA_ERRORS" FOR "SYS"."DBA_ERRORS""
    IMP-00008: unrecognized statement in the export file:
    . importing L1's objects into L1
    IMP-00017: following statement failed with ORACLE error 1435:
    "ALTER SCHEMA = "L1""
    IMP-00008: unrecognized statement in the export file:
    J
    Import terminated successfully with warnings.
    -------------------------------------b]
    So after analysing this log file, i created
    the appropriate drives and folders... as the
    import statement doesn't see them.
    E:\ORADATA G:\ORDATA etc...
    And i started to [b]IMPORT ONE MORE TIME. with:
    $ IMP73 sys/pssw Full=Y FILE=c:\temp\FOLD_1\data_1.dmp BUFFER=64000
    COMMIT=Y INDEXFILE=c:\temp\FOLD_1\BOO_idx.sql
    LOG=c:\temp\FOLD_1\BOO_log.LOG DESTROY=Y IGNORE=Y;
    after that i could not see the users nor the
    tables created.
    and the following message appeared in the log file:
    Warning: the objects were exported by L1, not by you
    . . skipping table "AN1999_BDAT"
    . . skipping table "ANPK"
    . . skipping table "BOAP"
    . . skipping table "BOO_D"
    ETC.....skipping all the tables
    . . skipping table "THIN_PER0"
    . . skipping table "UPDATE_TEMP"
    Import terminated successfully without warnings.
    and only 2 new tablespaces (originally 3) were
    created without any data in ( i check that in
    the Oracle Storage manager : the tablespaces exit
    with 0.002 used space; originally 60 M for each !!)
    so,
    How to import data (with full import option) succefully
    MORE THAN ONE TIME from an exported dump file ?
    Even if we have to overwrite tablespaces , tables and users.
    thank you very much

    The Member Feedback forum is for suggestions and feedback for OTN Developer Services. This forum is not monitored by Oracle support or product teams and so Oracle product and technology related questions will not be answered. We recommend that you post this thread to the appropriate Database forum.
    The main URL is:
    http://forums.oracle.com/forums/index.jsp?cat=18

  • Form Letter Report - How To Format Date and Number Hidden Fields

    Hi
    Is it possible to format date and number fields in a form letter report. This case were Paper Design shows fields as $<hire_date>. The examples in reference book only print character values which do not require formatting. I cannot determine how to achieve this. Cannot select fields from Paper Design view as per other report styles where can apply formatting. Do I have to perform formatting in the query to return date as string in format I wish for? This is not case for other report styles.
    Thanks

    you could add a field, set the source of the field to hire_date (assuming hire_date is a column in the data model), and put a format mask of whatever format you want. then set visible to No.
    then instead of &<hire_date> you can instead type &<name of your new field>.

  • How to transfer data more than 255 char from excel sheet to internal table.

    Hello Experts,
    I have a requirement where i have a text field in the excel sheet of more than 255 char and need to be updated in the text element. To do that i need to transfer the excel sheet data to an internal table where one of the field is more than 255 char.
    in the standard function module it works only upto 255 char. Can you help me if we have some other way to get more than 255 char in the internal table from excel sheet.
    Thanks in Advance.
    BR,
    RaJ.

    Using .xls, it is not possible transfer data more than 255 characters from excel sheet. However if the excel sheet is saved as Comma Delimited format or Tab Delimited format, then using GUI_DOWNLOAD function module data more than 255 characters can be transferred.
    File name should be : .csv (Comma Delimited format)  or .txt (Tab Delimited format)
    File Type would still remain 'ASC' while calling function module GUI_DOWNLOAD
    Also In the internal table declare the field type as String or LCHAR.
    Eg:
    TYPES: begin of ty_file,
            col_a TYPE string,
          end of ty_file.
    DATA: i_file type standard table
                   of ty_file
                 with header line
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      =  'C:\test.csv'
      TABLES
        DATA_TAB                      = i_file

  • How to Format Date / Time

    I found out how to retrieve date and time from the operating system, but how do i format it.
    I need the short and sweet versions.
    Example:
    // Retrieving from the operating system.....
    String system_date = new java.util.Date().toString();
    Now I want to parse the date string... for instance retriving the current date in this format (DD-MON-YYYY)....
    if u know another way to retrieve the date without parsing the string so I can just pull the year instead of everything....
    Thank You In Advance

    Try out this code:
    //TO GET THE YEAR AS A NUMBER, USE DE java.util.Calendar class
    Calendar rightNow = Calendar.getInstance();
    System.out.println("My age is " + (rightNow.get(Calendar.YEAR) - 1971));
    //TO FORMAT A DATE IN YOUR LOCALE USE, java.text.DateFormat
    DateFormat df = DateFormat.getInstance();
    System.out.println("The date right now is " + df.format(new Date()));
    //TO FORMAT A DATE IN ANOTHER FORMAT AND LOCALE...
    DateFormat df2 = DateFormat.getDateInstance(DateFormat.SHORT, Locale.CHINA);
    System.out.println("The date right now in China is " + df2.format(new Date()));
    I hope this soves your problem,

  • How to delete data older than three years from DSO

    Hi  all,
    We needs to keep historical data in the DSO only for three years. One way of doing this is by selective deletion we can delete data older than three years but we want to make it authomated. Is it possible to add a process or ABAP program to delete data older than three years.
    If it is p[ossible by ABAP code then can you please give me sample code.
    Many Thanks in advance.
    Harman

    Some time for in case of huge volume of data selective deletion is not works, Try for "prunning" option.
    It's work as follows
    1)     Create DSO which is same replica of your Source DSO.
    2)     Create two transformation
         a) from Source DSO to Copy DSO
         b) Another is from Copy DSO to Source DSO
    3)     Transprort Last 3 years records to Copy of Source DSO using DTP Filter range for time.
    4)     Once data loading from Source DSO to Copy DSO get completed delete all data from Source DSO.
    5)     Now load data from Copy DSO to Source DSO.
    6)     After complete loading delete entire data from Source DSO.
    I use prunning process to one of my client and it's work perfectly.
    Regards,
    Sushant
    +919820849482

  • How to format Data in subject line of an Email

    I have an email submit button on my LiveCycle form and the client wants data from the form in the subject line of the email. I have the button set up and the patterns set up on the fields but the data in the subject line doesn't display the way it does in the fields. this is what I have.
    var oDoc = event.target;
    var nSubject = Page1.Top.txtEmpID.rawValue + " " + Page1.Top.dteTo.rawValue;
    oDoc.mailDoc({
    cTo: "[email protected]",
    cSubject: nSubject,
    cMsg: Page1.Top.txtLastName.rawValue + " " + "Performance Agreement"
    The Employee ID is 7 digits including leading zeros (0123456) and the date is formatted MM-DD-YYYY. When it goes to the subject line it doesn't show the leading zeros (123456) and the date is formatted YYYY-MM-DD.
    Any help is appreciated, Thanks.

    To get the formatted date striong use formattedValue instead of the rawValue in your scriptings.

  • How to recieve data longer than 256?

    Anyone knows the typical way to handle a large block of data (more tahn 256 which is the MAX of LC)? If you can provide me a sample code, I will do appreciate!
    Neat

    If you are referring to data larger than 256, the same will need to occur on the host side. You will send an apdu requesting a block of data beginning at an offset. You can pass that offset value in the P1/P2/P3(LC). The applet will send n amount of data beginning at that offset. The LE is the length of the response data the card sent back not an offset.

  • How to format date/time in display hints?

    To those of you who know it:
    One of the attributes in a VO is of Date type. To display of the date in the format of "10/25/2009 11:45 PM", I only managed to display "10/25/2009 11:45" with only the clue of the few examples provided in display hints when doing the formatting (the format mask I use is MM/dd/yyyy hh:mm). I would appreciate it if someone could advise how to display the AM/PM part of the format mask. Or better yet, point me to a source of reference for such formattnig.
    Thanks!
    Newman

    Newman,
    As suggested by Puthanampatti, you have to use 'a' in the date pattern to display AM/PM.
    You can find date and time patterns in [SimpleDateFormat API doc|http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html] which describes more about the letters to be used for each pattern which you can also use with attribute display hints in VO.
    Sireesha

  • How to format data for a custom group

    Hi all
    I have a pivot table with Actual and Budget as columns and some accounts in the rows. Since I'm using the account hierarchical column, I created custom groups for the accounts using the Selection steps pane. For example, I created a new group called Profit to combine 3 different Profit accounts and display one Profit line.
    Now I want to format the data for the Profit group. I right-click on the Profit group, choose to edit the group and click on the Format button on the bottom left corner. I add some formatting, e.g. borders. When I now view the pivot table, borders have been applied to the label of the group - so the word Profit is now bordered. However, the values in the Actual and Budget columns do not have a border. Don't know what I'm missing, but I want both the group label and the values to be formatted the same way.
    How can I apply formatting to the data/values for the custom group?

    Yeah tried that already, it formats the entire column whereas I need just the values for the Profit row to be formatted. Seems it is a limitation only when using custom groups?

  • How to format date with in the file

    Hi,
    I have the below data in a file,
    101 02100002111406893401207310900A094101xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    5200xxxxxxxxxx D18000_1 CCDXXXXXXX JUL 31201207 1140689340000001
    622113010547999999999003 000333333334RE 00030137 onee SYSTEM 0140689340000001
    62200000 0000999999999001 0000011111CR460 00030135 twoo system 0140689340000002
    82000000040015507087000000000000000003571110D18000_1 140689340000001
    Can some one tell me how to read the date which is there in line 1 which is starting with indicator 1 at position 24 to 29
    in this example it is 120731
    which is in YYMMDD format
    I want to replace from 70 to 75 with above date + 2 as 120802 in 2nd line which starts with indicator 5
    My output should look like below in a file again
    101 02100002111406893401207310900A094101xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    5200xxxxxxxxxx D18000_1 CCDXXXXXXX JUL 31120802 1140689340000001
    622113010547999999999003 000333333334RE 00030137 onee SYSTEM 0140689340000001
    62200000 0000999999999001 0000011111CR460 00030135 twoo system 0140689340000002
    82000000040015507087000000000000000003571110D18000_1 140689340000001
    Can some one please tell me how to do this?
    Appreciate your response.

    The following will help you to extract the date and perform an arithmetic function on a date:
    olddate=$(head -1 myfile | cut -c 24-29)
    newdate=$(date -d "20${olddate} + 2 days" "+%y%m%d")You may have to implement some logic if the year is before this century, e.g 1999. For the rest I suggest you look into awk or sed to perform a string replacement based on character position.
    Edited by: Dude on Aug 7, 2012 12:57 PM

  • How to pass data more than raw limit..

    Hi,
    How can i send msg payload which has more
    data than 32k. I dont want to use OCI. I am
    trying to send a BIG XML through AQ.
    Thanks
    Dhiraj.
    Note in docs below it says:::
    For PL/SQL, Java and precompilers the limit is 32K; for the OCI the limit is 4G.
    From DOCS
    RAW" ---
    To store payload of type RAW, AQ creates a queue table with a LOB column as the payload repository. The theoretical maximum size of the message payload is the maximum amount of data that can be stored in a LOB column. However, the maximum size of the payload is determined by which programmatic environment you use to access AQ. For PL/SQL, Java and precompilers the limit is 32K; for the OCI the limit is 4G. Because the PL/SQL enqueue and dequeue interfaces accept RAW buffers as the payload parameters you will be limited to 32K bytes. In OCI, the maximum size of your RAW data will be limited to the maximum amount of contiguous memory (as an OCIRaw is simply an array of bytes) that the OCI Object Cache can allocate. Typically, this will be at least 32K bytes and much larger in many cases.
    Because LOB columns are used for storing RAW payload, the AQ administrator can choose the LOB tablespace and configure the LOB storage by constructing a LOB storage string in the storage_clause parameter during queue table creation time.

    Dhiraj,
    Its a PL SQL limitation that more than 32K cannot be passed as raw.
    You can use OCI Interface to achieve that. If you specifically dont want to use OCI, you can create an ADT with a lob in it and use PL/SQL to pass in raw data with size > 32K.
    null

  • How to format Date uptil the milliseconds

    Hi All,
    I am trying to use XSLT transformation and i need a timestamp till the milliseconds.
    I used the following function and it gave me time uptil seconds
    xp20:current-dateTime()
    So i added this transformation
    format-datetime(xp20:current-dateTime(), "[Y0001][M01][D01]_[H01][m01][S01][N001]")
    But it does not work. The transformation is failing. Can someone guide me as to how to achieve this?
    -Thanks in Advance,

    http://www.w3.org/TR/xslt20/#date-picture-string

  • How to format date and currency datafield in a Datagrid

    Hy folks
    I am getting my data from a web service (against a SQL server)
    After that convert the data in an ArrayCollection and
    Finally I use the ArrayCollection in a Datagrid ussing somethig like :
    <mx:collumns >
    <mx:DataGridcolumn datafield="EnvoiceDate" />
    <mx:DataGridcolumn datafield="EnvoiceValue" />
    How can I format a date tipe datafield in a Datagrid.
    I need to display da date in an format like  DD/MM/YYYY   ex     12/10/2009.
    I also need to display da number like 1345.87   as  1.345,87
    thanks in advance

    Binoy,
    create fields that refer to DATS and TIMS data types
    Thanks
    Bala Duvvuri
    Edited by: Bala Duvvuri on Aug 5, 2010 10:28 PM

  • How to format dates in SQLExec query

    I am trying to archive Lookout data to an Oracle database using SQLExec. I started with existing SQLExec code that put data into Access. Following is that code:
    "Insert into wind_temp (Rdate,Wind,Temp) values ("&text(now(Timer3),"0.00000000")&",
    "&text(\\SCADA1\Server\Drivers\Corral\ROCSouth.Wind,"0.000")&",
    "&text(\\SCADA1\Server\Drivers\Corral\ROCSouth.Temp,"0.000")&")", 8, no);
    The Rdate column in wind_temp table is date type. If I change the type to varchar2 (string) this works, so my ODBC connection is good. The problem is that for date fields Oracle needs a string in DD-MON-YYYY (i.e. 01-JAN-2002) format or string data converted to a date (i.e. to_date('01-JAN-2002 12:00:00','DD-MON-YYYY HH24:MIS')). Is there a way
    using the now() or other function to build a "to_date" string like above to pass to Oracle?

    Here you go:
    text(now(),"dd/mm/yyyy hh:mm:ss")
    This will give you slashes and not dashes and a number for the month and not the abbreviated name.
    Here is the expansion that does what you need:
    left(text(now(),"dd/mm/yyyy hh:mm:ss"),2)&"-"&if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="01","JAN",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="02","FEB",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="03","MAR",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="04","APR",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="05","MAY",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="06","JUN",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="07","JUL",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="08","AUG",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="09","SEP",if(m
    id(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="10","OCT",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="11","NOV",if(mid(text(now(),"dd/mm/yyyy hh:mm:ss"),4,2)="12","DEC","ERROR"))))))))))))&"-"&mid(text(now(),"dd/mm/yyyy hh:mm:ss"),7,15)
    The date I got from this was:
    11-APR-2002 11:54:35
    I would recommend using multiple expression objects to simplify reading the code. I included it here, all in one expression, so you could copy and paste it for testing.
    I tested it on Lookout 5.0. It works.
    Study the text() function and the general text manipulation functions. You can do just about anything with a little creativity.
    Regards,
    Tommy Scharmann

Maybe you are looking for

  • Word 2007 published as pdf opens by default in Photoshop

    I'm running XP SP2. When I "Save As" a Word 2007 document as "PDF", and then click "Publish", (the file name has an extension of .pdf, and the file type is .pdf), Photoshop opens automatically. What I want to have happen is for the the .pdf document

  • Solaris on Intel/apps for solaris compatibility

    Does anyone know how to run apps available for Sun solaris (sparc verion) to run on Intel solaris? I tried to install sybase client s/w on Intel solaris and obviously it bombed. Is there any kind of emulators or anything that would make this work? Th

  • Where can i find ozxmlscene DOCTYPE to validate the XML Motion files i create

    Hi , i'm creating Motion files to be inserted into FCP 7 TimeLine or Motion 3 It works perfectly except sometimes the XML file i produce crash FCP or Motion (theses .motn files are allways made with the same methods by a php script that produces UTF-

  • HT1420 De-authorizing a computer that crashed

    Hello! My old computer crashed so I cannot de-authorize it.  Tried authorizing my new computer, but we have too many computers associated with this account.  Question is:  How do I de-authorize my broken computer so that I can authorize my new comput

  • Project Plan for KM/ Cost Benefit Analysis document for KM

    Is there a template Project Plan Document available for KM? Is there a Cost Benefit Analysis document available for KM, that lists the advantages of KM, things like what are the Cost Benefits of Implementing KM? etc. Any help is greatly appreciated.