How to format date ?

[String tDate = "01/10/06";
Date dateTDate;
   DateFormat df = DateFormat.getDateInstance();
            dateTDate=df.parse(tDate);//tDate
            System.out.println("the date is "+dateTDate);I get this result --> " the date is Fri Oct 01 00:00:00 EST 6"
but I need this result--> the date is Sun Oct 01 00:00:00 EST 2006
The dates are on a file in SHORT date format. I need to read them back and perform calculations.
woops i think i got it ... DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.UK);
Message was edited by:
rigidyg

RTFM
see java.text.SimpleDateFormat

Similar Messages

  • 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 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 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 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 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?

  • 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/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 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

  • How to format data in internal table

    Hi Friendz...
    In a program i have transferred the data from a Excel Spread sheet (.xls file) to an internal table using FM <b>"ALSM_EXCEL_TO_INTERNAL_TABLE"</b>.
    The internal table is like this:
    begin of xl_data occurs 0,
         vendor name
         street
         address
         vat reg no
         bank no
    end of xl_data.
    now i have to include some more fields to this internal table and then i have to download this data to a <b>.txt</b> file.
    could you please tell me how should i do this?

    Please see this sample program.  It will upload from excel into internal table,  move data to another itab with other fields and download to C:\ drive.
    report zrich_0002.
    types: begin of ttab ,
          fld1(30) type c,
          fld2(30) type c,
          fld3(30) type c,
          fld4(30) type c,
          fld5(30) type c,
          end of ttab.
    types: begin of ttab2 ,
          fld1(30) type c,
          fld2(30) type c,
          fld3(30) type c,
          fld4(30) type c,
          fld5(30) type c,
          fld6(30) type c,
          fld7(30) type c,
          end of ttab2.
    data: itab type table of ttab with header line.
    data: itab2 type table of ttab2 with header line.
    selection-screen skip 1.
    parameters: p_file type localfile default
                'C:test.txt'.
    selection-screen skip 1.
    at selection-screen on value-request for p_file.
      call function 'KD_GET_FILENAME_ON_F4'
           exporting
                static    = 'X'
           changing
                file_name = p_file.
    start-of-selection.
      clear itab. refresh itab.
      perform upload_data.
      loop at itab.
        clear itab2.
        move-corresponding itab to itab2.
        itab2-fld6 = 'Another Field'.
        itab2-fld7 = 'No, really last one'.
        append itab2.
      endloop.
      call function 'GUI_DOWNLOAD'
           exporting
                filename = 'C:itab2.txt'
           tables
                data_tab = itab2
           exceptions
                others   = 22.
    * Upload_Data
    form upload_data.
      data: file type  rlgrap-filename.
      data: xcel type table of alsmex_tabline with header line.
      file = p_file.
      call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           exporting
                filename                = file
                i_begin_col             = '1'
                i_begin_row             = '1'
                i_end_col               = '200'
                i_end_row               = '5000'
           tables
                intern                  = xcel
           exceptions
                inconsistent_parameters = 1
                upload_ole              = 2
                others                  = 3.
      loop at xcel.
        case xcel-col.
          when '0001'.
            itab-fld1 = xcel-value.
          when '0002'.
            itab-fld2 = xcel-value.
          when '0003'.
            itab-fld3 = xcel-value.
          when '0004'.
            itab-fld4 = xcel-value.
          when '0005'.
            itab-fld5 = xcel-value.
        endcase.
        at end of row.
          append itab.
          clear itab.
        endat.
      endloop.
    endform.
    Regards,
    Rich Heilman

  • Formatting data series in charts

    Hello all,
    Need help in how to format data series used in charts(pie and bar). The charts show proper data but i need the amounts in the charts to be formatted using comma separators and $ symbol. Had tried using the NSTR functions and these work properly for table data , but not for charts.  Could someone pls conform if this is a known limitation with charts or is this yet another issue with ehp1 ? If so , are there any other alternatives for this approach.
    Vc version is 7.01 SP5 (ehp1)
    Any help would be appreciated.
    Rgds

    Did you try:
    OracleBI/web/app/res/s_.../popbin/
    EX:
    line.pcxml Look for <SeriesDefinition ...
    we modified the line width and a few other things. You'll have to modify all the pcxml files for all the chart types you want to customize.

  • How to get Date Format from Local Object.

    Hi All,
    I am new to Web Channel.
    I need to know Date format From date of locale.
    suppose there is a date "01/25/2010" date in date field I want to get string "mm/dd/yyyy". Actually I have to pass date format to backend when I call RFC. 
    Is there any way to get Date format from "Locale" object. I should get date format for local object
    I get local object from "UserSessionData" object but how to get Date format from it.
    I am not looking for Date value. I am looking for current local date format ("mm/dd/yyyy or dd/mm/yyyy or mon/dd/yyyy) whatever local date format.  I could not find example which show how to get date format from "Locale" object.
    Any help will be appreciated with rewards.
    Regards.
    Web Channel

    Hi,
    You can get it from "User" or "Shop" business object.
    Try to get User or Shop Business Object as shown below.
    BusinessObjectManager bom = (BusinessObjectManager) userSessionData.getBOM(BusinessObjectManager.ISACORE_BOM);
    User user = bom.getUser();
    char decimalNotation = user.getDecimalPointFormat().getGroupingSeparator();
    If you are seeing "1,234.00" then above code will return "."
    I hope this information help you to resolve your issue.
    eCommerce Developer.

  • How to print formated data/report on client's printer (Web Application)

    Hi All
    I want to print some formatted data/report ( it might be 1000 pages) on user's printer.
    Application is web based
    Technology used are Java - jsp - servlets
    i want functionality like...
    when user click on print button/link, data is fetched from server and all pages (it is formated data so i want alignment on page while printing) should be printed one after another.
    Also printer selection dialog should displayed one time when user click on print button/link.
    Questions:
    1. How i will transfer all data to client (web browser) from the server ??
    2. And how i can print that data on user's printer ??
    There is requirement (or limitation) that I can not use applet for this purpose.
    And also it is not fix that we must use java tech., we can use any othere tech. but condition is that it must support multiple platform (in short platform indipendant)
    There is solution like ...
    I can use window.print() function of DOM/JavaScript,
    but it prints only one page which is displayed on browser.
    I don't want to display any page. and want to print all pages.
    if any one done or have idea then let me know.
    Thanks in Adv.
    Shailesh Koradiya

    thanks linxpda for reply,
    we can use ActiveX component for windows platform for printing purpose, same way we can use platform specific component for printing... (for linux, unix, sun solaris etc...)
    if it is possible then let me inform.
    Thanks,
    Shailesh Koradiya

Maybe you are looking for

  • Error regarding Rg1 stock trial report

    i am stuck on a serious problem not able to calculate opening for every month and closing for every month plz help if u have correct solution senerio is like this opening     inqty    outqty    closing                         1             2         

  • Canon 1D MK2 - Every other photo is black? HELP

    I recently purchased a Canon 1D Mark II. I had it serviced, picking it up last Monday. Nothing was wrong with the camera. A coworker asked to take photos in the office. He stepped away, returning a few minutes later, asking me if the camera's taking

  • WebCRM Demo license

    Hi All, I have setup WebCrm on a test server with a demo license just to see if I can get it all working. I know I have to access the site locally and not across a network but besides this restriction, will all other functionality within the product

  • Animate Image in Cp 3

    Using Cp 3 I would like to have images appear to move across the screen. (ex. photo of a combine which would appear as if it is moving towards you or move across the screen to appear as if it is actually moving across the field)   I have tried the Zo

  • Optimum photo size for a slideshow

    what is the best size of photo (500kb, 1mb ect) for creating a slideshow that will have good resolution when put on a DVD?