Date and currency in business apps

Last year, I was concerned about the difficulty to use java.util.Date class in business applications.
See thread "Date is a mess for business use" at http://forum.java.sun.com/thread.jsp?forum=4&thread=464726
And yes, I continue to think that a Date with 61 seconds in a minute is unusable in a business environment !
We need to store business dates, not timestamps.
Working for an insurance company, suitable date and currency classes are of paramount importance, but Java doesn't include such classes, rendering its use very difficult, not to say almost impossible.
I just give here a pointer to some very interesting articles I just came across lately.
I think it can be of some help to people facing the same problems as me about Date and currency storage.
http://www.idinews.com/darkside.pdf
http://www.idinews.com/freeware.html
http://www.idinews.com/sourcecode/DateJava.html
http://www.idinews.com/sourcecode/MoneyJava.html
At last, with these two classes, we can do the same data processing as we did with all our cobol programs.
Happy reading !

I tried using the Money class on the compound interest example from http://www.cs.princeton.edu/introcs/91float/. Here's my code:
Money deposit = new Money(1000d);
System.out.println("Deposit = "+deposit);
System.out.println("Double precision interest = "+
     deposit.mpy(Math.pow(1 + .05 / 365, 365)));
Money dailyAmount = new Money(deposit);
for (int i = 0; i < 365; i++)
          dailyAmount = dailyAmount.mpy (1 + .05 / 365);
System.out.println("Daily calculated interest = "+dailyAmount);The output looks like:
Deposit = $1,000.00
Double precision interest = $1,051.26
Daily calculated interest = $1,049.40But the second value should be $1,051.27. Because Money uses a long to represent the amount I end up missing a penny when double precision rounding is applied, and because it rounds down I end up missing almost $2 when the amount is calculated daily.

Similar Messages

  • MS Word Web Service Interface: bad format of date and currency fields

    Hi,
    I am using MS Word Web Service interface to create contract documents. However, my date and currency fields show in a strange format. Date is in"YYYY-MM-DD" format, while currencies always have "." as decimal separator (probably technical values). My user settings are "DD.MM.YYYY" for dates and "n.nnn,dd" for decimal numbers.
    My workaround is to create a Z structure for WS interface with char fields and then do conversion through CRM_WST_RT_BADI->OUTBOUND_PROCESSING method. This works, but requires a lot of custom development.
    Is there a way to "tell" the interface to use correct formats in MS Word without doing it all manually through custom fields?
    Thanks!
    KR,
    Igor

    Oh, indeed!
    We might be closer than you think - I live close to Croatian-Slovenian border so we might pop out for a drink! But we can discuss this out of forum... 
    Now work again:
    Is there any documentation on possible formatting keywords? I suppose it's possible to set up decimal places, custom date formats etc.
    Cheers,
    Igor

  • How to set the Date and Currency Formats Based on Country

    Hi Friends,
    I am designing the one Global Form it will use for all countries.
    in that Form i want to print the date and currnecy Formats based on country.
    Like
    For US i want print the date and Currency Like This.
    Date -  MM/DD/YYYY
    Curremcy - XX,XXX,XX.XX
    For DE i want print the date and Currency Like This.
    Date -  DD.MM.YYYY
    Curremcy - XX.XXX.XX,XX
    Please suggest how i can control these things through Java Script or Formcalc....

    Hi Nitin,
    thanks For ur reply,
    i tried with this solution,
    But it is displaying the default Format like bellow formats.
    For short - mm/dd/yy
    For Medium - mmm dd , yyyy
    For Long     - thursday ,mmm dd , yyyy
    it was prinitng in above mentioned format,
    but here i want to print my own format for USA like MM/DD/YYYY.

  • When attempting to format region and set date and time the busy icon appears and seems to stay like this?

    when attempting to format region and set date and time the busy icon appears and seems to stay like this?

    Click on DU's Partition tab when you have the raw drive name selected, then set it to one partition, Mac OS Extended. If it crashes or freezes, it is finding a bad block and can't write.
    In any event, if you want to use the drive, and have not zeroed it before, you should now.
    Click on Erase -> Security Options -> Zero out data. Still with the full drive selected and not any partition(s).
    Then repartition the drive if needed.
    Boot from the DVD if that doesn't work. And no, TTPro has never mapped out bad blocks let alone create partitions.
    Disk Utility in 10.4.8 is quite good, excellent in fact. No need for an alternative.
    Your eMac drive may need to touch of Disk Utility itself. FSCK from the command line, clear the caches with Applejack along with check for corrupt plists. Between Disk Utilty and Applejack (free/shareware) never had to use TechTool Pro - or at least there weren't any errors after those two got done. But if you want a good 3rd party, pick up Disk Warrior 4.

  • Hi,I want  ABAP program to create an file of this data and to upload in app

    Hi Sir/Madam,
               I want  ABAP program to create an file of this data and to upload in application server.this is urgent requirement.plz reply soon. i'll b thankful to u.
    Regards,
    Vishali

    Hi ,
    Use this abap code .this will create a file in AL11 that you can use .
    data: d_msg_text(50),
          v_string(20000) type c,
          v_filename type rlgrap-filename,
    ******Create a file on app server
    concatenate '<directory name present in AL11 case sensitive>' ' filename.CSV' into v_filename .
    condense v_filename no-gaps .
    open dataset v_filename for output in text mode
    encoding default message d_msg_text.
    if sy-subrc ne 0.
      write: 'File cannot be opened. Reason:', d_msg_text.
      exit.
    endif.
    ****Header for file
    concatenate 'information you want to write in file like header etc ' into v_string separated by '|'.
    transfer v_string to v_filename.
    *****Write data into file by looping an internal table
    loop at  <internal table > assigning <work area>.
      concatenate      <work area>-field name1   <work area>-field name2    into v_string separated by '|' .
      transfer v_string to v_filename.
    endloop.
    close dataset v_filename.
    Hope this will solve your purpose.
    Regards,
    Jaya Tiwari

  • PostalOne Set Sch Induction Date and Time in Business Objects

    We are running Presort 8.00c, and our printer just told us that PostalOne will not run unles we have Set Sch Induction Date and Time set with parameters.  Where in Business Objects is this information coming from?  I am trying to find this informatin, and have a hard time.  Thank you for your help.
    Larry

    Larry,
    I'm assuming you are looking for the following to be populated in the mail.dat
    scheduled ship date - .csm
    scheduled ship time - .csm
    CSA Agreement ID - .seg
    CSA Trip Id - .csm
    Currently these are not populated by Presort and would need to be added by using a mail.dat editor.  This is something that our development team is looking at possibly adding in a future release.
    Thanks,
    Kendra

  • Storing date and hour in JDBC app

    I know that this is not exactly a JDBC problem, but some one could have
    some experience on it.
    I am storing the date and the time when a product change, I have 2 questions,
    How i can get the exact hour that the system is indicating in windows, no matter the time zone?
    And how i can do a validation to not let someone change the hour; or the date, if the application can not connect to Internet.

    Hi Battosai,
    Not sure about your second question, but as for your first question...
    "How i can get the exact hour that the system is indicating in windows, no matter the time zone?"
    Use the getTime() function in java.util.Date
    Hasman.

  • 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 view Date and Time in messages app?

    How do I display the date & time of every individual message, in "Messages" app [Version 8.0 (4226)] for OS X (10.9.4)
    It seems to sort messages sent within a few minutes of each other as conversations, and only inserts a timestamp every 5 or 6 messages....I need to see the date & time of each one.
    I know you can do this on the iPhone by pulling the screen to the left, so the data is there..., but I cannot figure out how to view it on my iMac.
    Thanks!

    Hi,
    Mouse over the text or Pic that was sent.
    That little boxed time stamp will appear  (It may be a yellow box in a Mavericks boot)
    9:13 pm      Saturday; August 9, 2014
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • How to edit XML parsed data and save on iPhone app

    Hi,
    How to edit and XML retrieved data that is displayed on an iPhone app and save again in the same XML file using iPhone SDK.
    In other words I want to change the XML file data or edit and save.
    Thnx in advance.
    Regards
    Amit

    Hello amit,
    No, not at all. Surely you will parse your XML file using the NSXMLParser class. OK! i think i get it now, do you wants to change/modify the value of any tag in the XML file? For that you will be required to parse your XML file using NSXMLParser class, and fill out some data structure (according to the the XML format) do some changes into your data structure, and then write your XML to the file (according to the edited data structure) using the method i told u earlier. This is what my preferred method is, and i am pretty much sure that it is not a bad way to do this at all.
    Hope this clarifies some of your queries.
    Best regards,
    Obaid

  • Would it be useful to set a partition on my internal HD only for data and the other for apps, OS and that kind of stuff?

    As I wrote in the title, would it be useful?
    I come from a Windows PC where I had that kind of division and it seemed everything had worked fine along 5 years.
    Please, give a motivation to your answers to let me get in the point.

    File fragmentation is not an issue with OS X, which looks after itself.
    Defragmentation in OS X:
    http://support.apple.com/kb/HT1375  which states:
    You probably won't need to optimize at all if you use Mac OS X. Here's why:
    Hard disk capacity is generally much greater now than a few years ago. With more free space available, the file system doesn't need to fill up every "nook and cranny." Mac OS Extended formatting (HFS Plus) avoids reusing space from deleted files as much as possible, to avoid prematurely filling small areas of recently-freed space.
    Mac OS X 10.2 and later includes delayed allocation for Mac OS X Extended-formatted volumes. This allows a number of small allocations to be combined into a single large allocation in one area of the disk.
    Fragmentation was often caused by continually appending data to existing files, especially with resource forks. With faster hard drives and better caching, as well as the new application packaging format, many applications simply rewrite the entire file each time. Mac OS X 10.3 onwards can also automatically defragment such slow-growing files. This process is sometimes known as "Hot-File-Adaptive-Clustering."
    Aggressive read-ahead and write-behind caching means that minor fragmentation has less effect on perceived system performance.

  • I got a new phone and restored my data and i have no apps

    help!

    Help what?
    Your apps will only be where you put them.
    If you failed to keep them on your computer then you will have to redownload them.

  • When I sync my iPhone 4S to my computer, where is the baseline data and documents coming from? Is the iPhone's set of apps and data the default set or are the apps and data on the computer (in the backup? in iTunes?) the default set?

    I am having a great deal of trouble with the upgrade to ios 7 on my 4S. The syncing and the software updates always leave generic icon apps that I have downloaded in the past but have deleted from my phone. But they keep reappearing. A restart of the phone fixes the icons but they are loaded not at the last page of the home screen but on completely random pages, screwing up my app and folder layout.
    I want to completely wipe the phone and restore the apps one by one, but I am concerned about whether the data and documents for those apps that I reinstall will be intact. Does the syncing for the apps on the phone retrieve the data from the last backup on the computer? If so, does it only sync the apps on the phone or does it try and reinstall all the apps that there is data for in the backup? In other words, does the resulting set of apps and data reflect the current state of the phone or the saved state of the backup?

    Apple guys are deleting posts. I have found my posts have been deleted. Apple should MUST let us downgrade at least to previous release from current which was working fine.

  • Experience updating app, keeping user data, and extending SQLite tables?

    We're updating an application in the App Store, and haven't yet found good information on how to deal with updates to the SQLite Schema and data that should be transferred between apps.
    Anyone successfully done this?
    Q1: Does the old DB files stay on the iPhone after update? Does the installer do a "diff" between them? In our case, we just extended tables, rather than changing them, in hope that we can successfully move the data for users gracefully.
    Q2: If the installer does in fact wipe all the data and files on the app before install, is there a way to access the data before it updates, so the app can gracefully update the data?

    Would you mind sharing your solution?
    I've implemented it by using the PRAGMA SQL statements to query the table structure, and if it's missing the column I need for the new version, adding it.
    The bigger problem, though, is some of my users have experienced their data being deleted when they received an updated version from the app store.

  • Mail and Google Business Apps - can get incoming mail but not send

    I'm using the mac mail client for 3 different accounts - one regular gmail account, and 2 Google Business App addresses that are like [email protected]
    2 of these accounts are working and have always worked fine: the regular gmail, and one of the business app accounts
    But my newest one can recieve mail, but cannot send mail OUT. I've looked at my settings and compared them to Google's over and over, and compared them to the other business account that works. They are all set up correctly. ALL of the settings are set up the way they  should be.
    Has anyone else had this problem?

    Mail/Window/Connection Doctor - if a server shows red, select it and look at the 'Show Details' box.
    Troubleshooting sending and receiving email messages

Maybe you are looking for

  • Odd screen appearance on opening PS elements 2 (screenshot)

    http://img.photobucket.com/albums/v214/wfhguy/PSElements2ScreenShot.jpghttp:// Lately I've been having this problem when I use Photoshop. It's an old  version (PS Elements 2). Often, but not always, when I open up the  program, part of the previous s

  • Photoshop Elements will not open after download complete

    It says my download is complete, but I cannot open Photoshop Elements.  I have a Macbook Pro Mac OS X 10.7.5.  I would love any kind of help...very difficult to find the answer.

  • Inability of dvd disc to play on other computers

    After burning a disc using premiere elements 2.0 it will not play in other computers. It will play on stand alone dvd players with a tv. but not on computers Why?? Am I missing something in the process?

  • Installig Blackberry Desktop Software on a windows 8 PC

    I am having problems installing the blackberry desktop software on my OS WINDOWs 8 to allow me tether my smartphone with my desktop for me to enjoy d data plan for my internet connectivity. I have downloaded the software but Windows tells me that " t

  • Getting size of children

    Hi, I have a panel with a BoxLayout to which I need to add a variable amount of "sub-panels". The thing is that I need to know the actual height of these panels, because the heigth will depend on the number of "sub-panels" I add. I've tried with ever