Another way to format dates

We were trying to retrieve a date from BC4J in a desirable format. We did look at the HOWTO that was posted, but found we would have to alter every date to a custom domain object in the BC4J layer. So we made a little utility method to help in any webbean we made that returned an oracle.jbo.domain.Date object:
* Sets the default date format for the webbean display of dates.
* @author Aaron Haimovitz
* @param formatmask Format to display the dates in
* Examples<br>
* <ul>
* <li>"yyy.MM.dd G 'at' hh:mm:ss z" = 1976.03.09 BC at 11:21:56 PDT
* <li>"h:mm a" = 12:08 PM
* <li>"yyyy-MMM-dd" = 1976-MAR-09
* </ul>
*<div style="color:red">Default value is "dd-MMM-yyyy"</div>
public void setDateFormat(String formatmask){
this.dateformat = formatmask;
public String getFormatedDate(String date, String formatmask){
String formattedDate;
oracle.jbo.domain.Date ds = new oracle.jbo.domain.Date(date);
SimpleDateFormat dFormat = new SimpleDateFormat(formatmask);
java.util.Date newDate = (java.util.Date) ds.getData();
formattedDate = dFormat.format(newDate);
return formattedDate;

We were trying to retrieve a date from BC4J in a desirable format. We did look at the HOWTO that was posted, but found we would have to alter every date to a custom domain object in the BC4J layer. So we made a little utility method to help in any webbean we made that returned an oracle.jbo.domain.Date object:
* Sets the default date format for the webbean display of dates.
* @author Aaron Haimovitz
* @param formatmask Format to display the dates in
* Examples<br>
* <ul>
* <li>"yyy.MM.dd G 'at' hh:mm:ss z" = 1976.03.09 BC at 11:21:56 PDT
* <li>"h:mm a" = 12:08 PM
* <li>"yyyy-MMM-dd" = 1976-MAR-09
* </ul>
*<div style="color:red">Default value is "dd-MMM-yyyy"</div>
public void setDateFormat(String formatmask){
this.dateformat = formatmask;
public String getFormatedDate(String date, String formatmask){
String formattedDate;
oracle.jbo.domain.Date ds = new oracle.jbo.domain.Date(date);
SimpleDateFormat dFormat = new SimpleDateFormat(formatmask);
java.util.Date newDate = (java.util.Date) ds.getData();
formattedDate = dFormat.format(newDate);
return formattedDate;

Similar Messages

  • HT4571 I have been trying to add data to my I pad and when I add it it goes to a page that says error. Is there another way to add data?

    I have been trying to add data to my I pad and when I add it it goes to a page that says error. Is there another way to add data?

    The installer is over 5Gb's and could take many hours to download.
    Check the download status in the App Store application.

  • Best way to store data

    Hi,
    i need to read some data in my application. Now this data are stored in a mysql db and are about 6000 rows. In another application that i've developed I used the sqlcipher library but I want to know if there is another way to storing data. This data will be absolutely crypted.
    thank you

    hi etS23 & welcome.
    You should perhaps investigate using Apple's CoreData as covered here:
    http://developer.apple.com/iphone/library/referencelibrary/GettingStarted/Gettin gStartedWithCoreData/index.html

  • Formatted Data Labels in CFCHART

    Is there a way to format data values in CFCHART?
    All my values in database are stored as 99.9 See below). These are percentages that I need to display on a bar chart. Everything works fine except when displaying 76.0, it shows as 76. All other values that have a number besides zero after the decimal point show up fine except for zero. I want the numbers to be consistent. I am already using custom XML file for formatting but unable to display the "zero" after the decimal point.
    Let's assume, StartYear = 2007 and EndYear = 2008, and the data in Influencer_Data table looks like this:
    ID      Poll_Year     Company    Influence_ID      Pulse      Goal
    96      2008            XYZ            842                  59.6      59.6
    97      2008            XYZ            839                  80.8      80.8
    98      2008            XYZ            838                  86.9      86.9
    99      2008            XYZ            841                  67.1      67.1
    100    2008            XYZ            840                  66.3      66.3
    101    2008            XYZ            470                  54.5      54.5
    102    2007            XYZ            842                  56.5      56.5
    103    2007            XYZ            839                  81.5      81.5
    104    2007            XYZ            838                  85.5      85.5
    105    2007            XYZ            841                  71.2      71.2
    106    2007            XYZ            840                  76.0      76.0
    107    2007            XYZ            470                  54.2      54.2
    108    2008            XYZ            843                  82.6      82.6
    And the data in influencers table looks like this:
    Influencer_ID Influencer_Type
    470      Regulators
    838      Financial Community
    839      Community Leaders
    840      Media
    841      Government
    842      Advocates
    843      Mexico
    <cfloop index="i" from="#StartYear#" to="#EndYear#" step="1">
         <CFQUERY NAME="GetInfluenceData#i#" DATASOURCE="#RMIDSN#">
              Select     ID.*, I.Influencer_Type
              From     Influencer_Data ID
                   INNER JOIN Influencers I ON ID.Influencer_ID = I.Influencer_ID
              Where     ID.Poll_Year = <cfqueryparam value="#i#" cfsqltype="CF_SQL_INTEGER">
                   AND ID.Company = 'XYZ'
              Order     By I.Influencer_Type
         </CFQUERY>
    </cfloop>
    The custom XML file (TLRIS.xml) looks like this:
    ?xml version="1.0" encoding="UTF-8"?>
    <frameChart isInterpolated="false">
              <frame xDepth="4" yDepth="5" outline="black" isVGridVisible="true"/>
              <xAxis>
                   <labelFormat pattern="#0.0"/>
              </xAxis>
              <yAxis>
                   <labelFormat pattern="#0.0"/>
                   <labelStyle orientation="Horizontal"/>
              </yAxis>
              <dataLabels style="Value" font="Arial-12" isMultiline="true">
              <![CDATA[ $(value) ]]>
              </dataLabels>
              <legend allowSpan="true" equalCols="false" isMultiline="true"/>
              <elements drawOutline="false">
                   <morph morph="Grow"/>
              </elements>
              <popup decoration="Round"/>
              <paint palette="Fiesta" paint="Plain" isVertical="true" min="47" max="83"/>
              <insets right="5"/>
    </frameChart>
    And the code for the graph is below:
    <cfoutput>
    <cfchart format="#ChartType#"
         chartheight="300"
         chartwidth="750"
         scalefrom="0"
         scaleto="100"
         foregroundcolor="##000000"
         databackgroundcolor="##ffffff"
         font="Arial"
         fontsize="10"
         labelformat="number"
         style="TLRIS.xml"
         show3d="yes"
         showlegend="yes"
         tipstyle="mouseOver"
         tipbgcolor="##FFFF00">
         <cfloop index="i" from="#StartYear#" to="#EndYear#" step="1">
              <cfset LoopCount = LoopCount + 1>
              <cfset WhichColor = ListGetAt(colorlist, LoopCount)>
              <cfchartseries     
                          type="bar"
                         serieslabel="#i#"
                         seriescolor="#WhichColor#"
                         datalabelstyle="pattern">
                         <cfloop query="GetInfluenceData#i#">
                                    <cfchartdata item="#Influencer_Type#" value="#Pulse#">
                         </cfloop>
              </cfchartseries>
         </cfloop>
    </cfchart>
    </cfoutput>

    mohadi wrote:
    I have already done that with no success.
    I am beginning to believe this may be a bug.
    Even if you try something as simple as the following, the decimal points that have zeroes don't show
    <cfchart style="beige">
    <cfchartseries type="pie">
    <cfchartdata item="New car sales" value="50.0">
    <cfchartdata item="Used car sales" value="55.0">
    <cfchartdata item="Leasing" value="56.5">
    <cfchartdata item="Service" value="76.2">
    </cfchartseries>
    </cfchart>
    Well that is the wrong kind of chart and it is not using the xml style.  But it works perfectly with a bar chart, using a custom style. The values display exactly as you have them above.
    <cfchart style="myPatternStyle.xml">
        <cfchartseries type="bar">
            <cfchartdata item="New car sales" value="50.0">
            <cfchartdata item="Used car sales" value="55.0">
            <cfchartdata item="Leasing" value="56.5">
            <cfchartdata item="Service" value="76.2">
        </cfchartseries>
    </cfchart>
    <!--- snippet from xml styles --->
    .... other xml ....
    <yAxis scaleMin="0">
          <titleStyle font="Arial-12-bold"/>
          <dateTimeStyle majorUnit="Year" minorUnit="Month"/>
          <labelFormat style="Pattern" pattern="#,##0.0#######"/>
    </yAxis>
    .... other xml ....

  • Can you transfer data from one numbers spreadsheet to another using conditional formatting?

    I have a tracker document set up for client payments and when I indicate payment received, it  flags green using conditional formatting. However I would like these to automatically transfer to another sheet - without having to cut and paste the associated data to the other sheet. Can I set up conditional formatting to do this? If not how could I get and automatic transfer?
    thanks forum.

    Hi Kangers,
    There are a number of ways to transfer data from one table to the next. It should not be hard to set up.
    Conditional formatting would not be involved it moving the data but you could set it up to flag the data in the new table.
    Without knowing what your tables and data look like it is hard to propose a solution.
    quinn

  • My ipod touch is currently running ios 4.2.1 I would like to run ios 5 or 6. When I try to update it on itunes, it tells me my software is up to date. Is there another way to upgrade the IOS?

    My ipod touch is currently running ios 4.2.1 I would like to run ios 5 or 6. When I try to update it on itunes, it tells me my software is up to date. Is there another way to upgrade the IOS?  Do I have to go to Settings>General>reset>Erase all content and settings before I can get the newer ios?  If this is the case, how can I ensure all my content is backed up prior to erasing it all. Is there anyway to check to ensure the backup is complete and comprehensive?  THanks!

    A second generation iPod touch can't be updated past 4.2.1.
    (88824)

  • Different ways to Transfer data from one database to another database

    Hi all,
    What are the ways to transfer data from one database to another database. With the following options, i Can transfer data as far as i know. Please
    correct me if i am wrong or tell me if there is any other options are available.
    1) Create database link/connection string and using this string and COPY command, we can transfer data.
    2) By using Export and Import utilities.
    I told first one to my interviewer, he told, its strange, by using, COPY command also can we transfer data ? As far as i know, we can transfer data. Am i right ?
    Thanks in advance,
    Pal

    transfer data from one database to another database.You mean store the data of one to another?
    1) Create database link/connection string and using this string and COPY command, we can transfer data.every SELECT on a DB-link is transfering data. And you can have all kind of transfers and store on the e.g CTAS of materialized views or.... the SQL*PLUS COPY :
    The COPY command is not being enhanced to handle datatypes or features introduced with, or after Oracle8i. The COPY command is likely to be made obsolete in a future release.
    But there are many others. Check for ORACLE Streams, and the "COPY" your interviewer was mentioning is about the operating file system COPY right? That's transportable tablespaces.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17120/tspaces013.htm#ADMIN11403
    -- andy

  • Is there a way to download data into CSV format?

    Is there a way to download data into CSV format?
    I can't do this using delimiter as ',' because user wants the decimal format in the ','s only.
    Any suggestions?

    go through this link...
    Download CSV file in presentation server through FM GUI_DOWNLOAD
    Re: how to create a CSV file
    type-pools:TRUXS.
    data: begin of itab occurs 0,
          vbeln like vbap-vbeln,
          posnr like vbap-posnr,
          end of itab.
    data:  itab1 type TRUXS_T_TEXT_DATA.
      select vbeln
             posnr
             up to 10 rows
             from vbap
             into table itab.
    CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
    EXPORTING
       I_FIELD_SEPERATOR          = ','
      TABLES
        I_TAB_SAP_DATA             = itab
    CHANGING
       I_TAB_CONVERTED_DATA       =  itab1
    EXCEPTIONS
       CONVERSION_FAILED          = 1
       OTHERS                     = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
       CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename = 'C:TEMPtest.TXT'
        TABLES
          data_tab = itab1
        EXCEPTIONS
          OTHERS   = 1.

  • [RB 6i] Format text in the field using HTML-tags. Or another way...

    If some fields of tables in database contain html tags such as 'H<sub>2</sub>O' (here is html tag 'sub') or 'some<b>text</b>'(here is html tag 'b') how can I to make Report Builder 6i to understand these tags or at least don't show them?
    Or how in another way can I format a part of text inside the field?
    thanx before
    Max

    Hi Maxim,
    If the output is PDF, the only way is to filter the incoming values yourself. You will need to create a PL/SQL column and remove the HTML markup tags. This, of course, leaves you without attributes you wanted in text (ie: the no "Bold" characters). You can still do this in with the same report basing the output from the PL/SQl formula column on the "desformat" input parameter.
    Reports doesn't have any "markup" capability. ie: A field only has one font & one colour. You can have multiple fonts for boilerplate text but, again, only a single colour.
    Robin.

  • Best way to pass data sets to another program

    Hey
    I want to connect another (maths) program with my java application. Therefore I need to paste data (some kind of tab separated table) to this program.
    I try now to save these data in a separate newly generated file and to pass a command with Java's Runtime.exec() method to this program to read these data. Is this a good idea or might there be better ways?
    If I do so, is there a way in Java to generate some kind of a "temporary" file which will be deleted automatically after usage or is this nothing else than to save it in a common file and delete it afterwards. What's the best way to pass data generally?

    Well, the connection will not be over a network, so I'd rather think it's not a Socket or RMI problem (unless someone convinces me).
    Yes it's very external, it's a C or C++ written program, I don't have any source codes. So far I generated a file for Input command and data, I passed that on to the maths program and returned the output into another file.
    Now I would like to separate the output and like to obtain some tables and graphical things like charts at the output. Do I have to generate three different types of outputfiles? How to store some graphics e.g. some distributions. I thought even of generating a database. I never thought about XML, I don't know if this works for that kind of problem?!

  • Best way to move data and programs to another profile on same Mac?

    Hello,
    What is the best way to move data and programs to another profile on the same Mac? I have a user who's profile is corrupt, I know that most programs will work on both the new and old profile however when trying to copy the Desktop folder, or Documents folder I am getting permissions denied.
    Sort of like weeding a garden, I'm hoping I do not have to pick the data in each folder and copy individually.
    Thanks for your help!
    Johnathon

    This usually means that a configuration or preference file is corrupted.  In this user's /Home/Library/Preferences/ folder locate any preference files associated with iLinc and drag to the Trash.
    I would also check in the /Home/Library/Caches/ folder for a file or folder associated with iLinc and delete as well.
    See if the problem is resolved in the user's normal account.
    It's not that you cannot copy data from account to account, but doing so causes a lot of permissions issues that must be resolved.  The MacFixit article I linked above shows what you need to do after transferring from one account to another in order to change permissions on the "foreign" files to those of the destination account.

  • Display hints, custom format method in VO, is there yet another way?

    Did you experience the same and had a solution?
    Hi,
    I am using JDeveloper 10.1.3.4 and looking for yet another way of customizing the display of an attribute of a view object.
    I have two tables: BILL and AWARDS, with composite foreign key relationship (on the LDAP_UID and TERM fields) between them, as illustrated below.
    The BILL table:
    NAME       LDAP_UID    TERM   CREDIT_HRS
    Tom Smith  tom.simth   200902       12.5
    Jane Lopez jane.lopez  200906        4.0
    The AWARD table:
    LDAP_UID    TERM  SOURCE     APPLIED
    tom.smith  200902 Perkins     2000.00
    tom.smith  200906 Direct      1300.00
    jane.lopez 200906 CN           500.00 At the business data model level, this is master(Bill)/detail(Awards) relationship. Bill is dragged from the data control palette to the page and displayed as a form, and Awards is dragged to the page as a table. When tom.smith logs in and chooses the 200902 TERM, the master and detail are joined on tom.smith=tom.smith and 200902=200902, so the $2,000.00 of Perkins loan is retrieved for him:
    Name Tom Smith
    Term 200902
    Source    Applied  
    Perkins   $2,000.00That works fine but not user friendly: the values in the TERMS column are a bit cryptic and need to be displayed in plain English, i.e., 200902 should be displayed as "Spring 2009" and 200906 as "Summer 2009". The display hints in the VO can not handle this. The only other way I know is writing a method in the Row class of the VO to do the translation. And this is the result:
    Name Tom Smith
    Term Spring 2009
    Source        Applied  
    No rows yet   Obviously, "Spring 2009" is used not only for display, but also for joining the master and detail tables. Of course "Spring 2009"!=200902, therefore no detail is retrieved for the user.
    Question is: is there yet another way to customize the display, that does not affect the join of master and detail tables?
    Many thanks for your help!
    Newman

    Hi, Chris,
    That works!
    I found the chapter where transient attribute is explained and an example is given creating a transient attribute in the entity object. It turned out that transient attribute works both in entity object and view object. I did it in the VO and it solves my problem.
    I spent hours of time before posting that question, trying two different ways but neither worked. Your one sentence saved me a lot of time. I do appreciate you help very much!
    Truly,
    Newman

  • With 10.7.2 update iCal does not allow you to set "Reminders" by draging events from "All Day Events" into "Reminders" is there another way to do this instead of having to type out the entire reminder with date, time, and type?

    With 10.7.2 update iCal does not allow you to set "Reminders" by draging events from "All Day Events" into "Reminders" is there another way to do this instead of having to type out the entire reminder with date, time, and type?
    With Lion 10.7.1. you where able to drag events from "All Day Events" into the "Reminders" bar to create upcoming reminders.

    Exactly the same question I was about to post!
    Great being able to sync reminders (well overdue) however if I have to re-type a calener envent into reminders it's a waste of time!! 
    Come on Apple!!
    Just need an option for the calender event to add to reminder or the old drag to add to reminder functionality back, Please???

  • What are the diffrent ways to copy data from one application to another?

    Hi,
    Can you guys tell me what are the different ways to copy data from one application to another application??
    I know we can do it through script logic using DESTINATION_APP.
    Is there any other way to copy data from one application to another application?
    Please help me
    Thanks,
    Charly

    You can also call a custom DTSX package in SSIS via the datamanager.
    there are at least 5 ways of transfering data in BPC between apps.
    1. Through the front end (excel etc) via evdre/evsnds
    2. Through Script logic using *Dest App
    3. Using BPC's standard export dtsx package via DM
    4. Using SSIS using BPC's custom SSIS tasks
    5. Through Script logic using stored procs.
    i am sure people will come up with more.
    remember if you use ssis and move data into any table but the wb, you need to process the cube afterwards.

  • I can't seem to find the data tab in format inspector...is there any other way to format numbers as currencies?

    I can't seem to find the data tab in format inspector...is there any other way to format numbers as currencies?

    Hi Aakritie,
    What version of Numbers are you using?
    What operating system?
    Your profile shows  Macbook Pro  (that is OS X) and also iOS
    I am using Numbers 3.2 on a Mac book Pro under OS X 10.9.2
    Format Inspector shows this when a cell is selected:
    Then choose a Data Format:
    Then:
    Regards,
    Ian.

Maybe you are looking for