How to I format currency and date?

Hi,
I have the following code that does that:
String price;
String date;
while (rs.next())
   price = rs.getString("mb_Price");
   date = rs.getString("mb_DeliveredDate");
}price variable will display as "35.950000000000003"
how do I format it such that it will display as "$35.95"?
for the date value, how do I format it such that it will display "dd-mmm-yyyy"?

Hi,
you could use this:java.text.NumberFormat nf = java.text.NumberFormat.getInstance();
nf.setMaximumFractionDigits(2);
double d = 35.26999;
java.util.Date da = new java.util.Date();
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd-MMM-yyyy");
System.out.println("$" + nf.format(d));
System.out.println(sdf.format(da));HTH

Similar Messages

  • I had a trouble with my lap top and had to format hard disk and install all soft ware again. could any body tell me how to transfer the application and data in my i phone back to my laptop.

    I had a trouble with my lap top and had to format hard disk and install all soft ware again. could any body tell me how to transfer the application and data in my i phone back to itune.

    You can't. It still thinks that your iPhone is synced with another iTunes library (the one that you had before you reformatted the hard drive.

  • I had a second hard drive added to my Mac Pro.  How do I format it and not effect my orginal hard drive?

    I had a second hard drive added to my Mac Pro.  How do I format it and not effect my orginal hard drive?

    Just format it with Disk Utility as mentioned above.  Select the new disk on the list at the left.  Click the erase tab.  Specify Mac OS Extended (Journaled) if not already specified and give the disk a name of your choice.  Then click the erase button.
    That's the simplest way to format a disk with a single partition (volum). If you want to create multiple volume (partitions) then click the Partition tab instead of Erase.  You can then use then specify a number of volumes and size each volume by specifying its size or just dragging the slider in the bootm right of each partition.  Give each a name as before and again Mac OS Extended (Journaled).  Click Apply button to create the partitions.
    Since you appear to be new at this just "play" with the erase and partition settings so you can become comfortable with them.  So long as you have the new disk selected on the left you can't really hurt anything since it's a new disk and no data to loose.  You can always go back and erase it back to a single partition.

  • How do i reset time and date on my itouch

    how do I reset time and date on my itouch?

    Go to Settings>General>International and make sure that Calendar is set to Gregorian.
    Bext
    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up                             
    - Restore to factory settings/new iOS device.
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar          

  • "Amount, currency, and date fields and service provider reset"

    Hi all,
    I am trying to save a trip request via TCode: TRIP but receive the following message:
    "Amount, currency, and date fields and service provider reset"   Messsage no. PTRA_WEB_INTERFACE150
    The system is on ECC6.0 with IS-PS (i.e. Funds management activated).
    Anyone encountered this previously - hope you can share your solution.
    Thanks in advance.

    Hi
    I am also facing the same and checked the table mention below and dates are same but still facing the error "Amount, currency, and date fields and service provider reset" along with other error message i.e "Expense type not allowed (T70S_RECEIPT)" .
    Please guide .
    V_T706B1
    V_T706B1_A
    V_T706B1_B
    V_T706B4
    V_T706B4_A

  • How do I transfer files and data from my Samsung Galaxy tab 2 to my Macbook Air?

    How do I transfer files and data from my Samsung Galaxy tab 2 to my Macbook Air? The Macbook does not even recognize the device. I get an error message. I follow the instructions on the message, which tells me to install "Kies" and Android file transfer. This does not help. What do I do?

    See:
    iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device

  • How to avoid the Amount and Date values for VOID Cheques

    Hi All,
    I had created a two window i.e For Amount and Date. If I process the cheque the Amount value and Date should not trigger for VOID CHEQUES.
    Can any one tel me how to avoid the Amount and Date values for VOID Cheques
    Your help will be greatly appreciated.
    Regards
    Yathish

    Hi,
    I dont know which tablel you are referring to, is it PAYR table and the field VOIDR?
    If a cheque is voided, it would have a reason and it is stored in VOIDR field of this PAYR table.
    Check if the field VOIDR is filled, if it is filled, do not print the amount and date.
    Regards
    Subramanian

  • How to set default currency and Country in R12 financial modules

    Hi all,
    How to set default currency and Country in R12 financial modules (AR,AP,GL,FA,CE) becuase I found some default settings are shown "USD" & "United States" such as create AR Customer, the Country is shown the default "United States"....
    Can anybody advise ?
    Thanks & Regards,

    Hi,
    Change the below profile for the user to a territory different than the US :
    In System Administrator, navigate to Profiles -> System.
    Select Site, Application, and Responsibility.
    Profile options:
    Default Country
    HZ: Reference Territory
    ICX: Territory
    Regards,
    Raju.

  • How to get current time and date??

    How to get current time and date from my PC time and date to the java application??
    i use java.util.* package but got error, that is:
    - java.util.* and java.sql.* class are match
    - abstract class cannot be instantiated
    so what can i do, pls guide...thanks...

    There is a method in the System class that will return the current system time. You could also instantiate a Date, Time, Timestamp, or Calendar object, all of which get created with the system time by default.
    Don't import *. Import the specific classes you need.
    Next time, post the actual text of the exceptions/compile errors. If you make people guess, most just won't bother.

  • HT1386 how to backup my apps and data before update to iOS5

    how to backup my apps and data before update to iOS5

    When you update, iTunes will backup your iOS device.  You can also do it manually... http://support.apple.com/kb/ht1766

  • How to extract the size and date from a given file

    Hi,
    I want to extract the size and date of a file (it can be either a video, audio or text file) that the user points to the location of. But I am not sure how. Does Java have an api that can do this? If not is there some other way of doing this? Can anyone help? Thanks in advance.

    Have a look at java.io.File, specifically
    public long lastModified()
    This format returned (I find) is nasty, so then use java.util.Date (or java.sql.Date, look the same on the surface to me) to format it.
    Cheers,
    Radish21

  • How to get System Time and Date?

    Hi, may i know how do i get the System's current Time and Date?? And i need to format them into 2 separate String, that's Time is a String, Date is another String. Pls guide me. Thanks a lot!

    What's the problem? The previous example was pretty clear. Just adapt it to your purposes...
            Date currentDateAndTime = new Date();
            SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
            SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
            System.out.println(dateFormat.format(currentDateAndTime));
            System.out.println(timeFormat.format(currentDateAndTime));

  • How to transport the CO and DATA file to SAP system

    Hello Experts ,
                          I want to know the procedure to import a transport request into an isolated SAP system ( which is not in the transport route ) using the CO and DATA files .
    I know that user should have adminstrator role to do this but i dont know how to do this .
    Regards
    Vivek

    Simply copy the source cofile and datafile from the source system to the target system and then import.
    Data file is located at /usr/sap/trans/<sid>/data with format R<transport_number>.<sid> and cofile is located at /usr/sap/trans/<sid>/cofile with format K<transport_number>.<sid>
    Copy them to the same location on the target system and then go to STMS -> Extras -> Add -> insert the name of the transport in format <sid>K<transport_number>, this will add the transport to the import queue then just simply import the transport.
    Regards
    Juan

  • UC320: how to set (correct) time and date, upload own AA messages, get caller ID, telnet?

    Hello there,
    Just trying out the UC320 I got borrowed from Cisco AT for testing with firmware 2.1.2 (1) localized for Austria.
    The device is connected to the cable modem of my ISP (Kabelsignal) utilizing two FXO ports, getting an IP address from my DHCP being connected to a WS-C2960G-24TD (LAN 1@UC320 connected to Gi0/18@C2960G port macro Cisco Switch enabled).
    Now I would like to try/see the following features:
    - a correct time and date: huh? hwo/where???
    No option to set this right??? No NTP option??? Am I just blind or too stupid to find that option/s?
    - upload own messages for the AA: ok, there are german messages but someone might have a little bit personalized ones - maybe telling callers the company name before asking them to dial the extension if they know it. Making custom messages is not the problem - but how to upload and in which sound/data format?
    - caller ID: my ISP told me that he transfers the caller ID correctly to analoge end devices if caller ID is available and not suppressed. All I can see when a call comes in is which FXO Port is being used by that call. So callback entries on the SPA phone is senseless. Any advise?
    - CLI: You can telnet the device - but which credentials to use to successfully logon? The pre-assigned credentials form Cisco AT are not accepted for logon.
    BTW @Cisco guys: I am also voting for support for the older SPAs (e.g. 942)

    Hi Claus,
    Thanks for giving the UC320W a spin and glad you found the support community!  Let met see if I can help answer your questions....
    Time/Date & NTP -- The UC320W is preconfigured with Cisco's Small Business NTP server.  The preferred method for correct time you will need the UC320W WAN to be connected with Internet access.   If there is no WAN connectivity there is a feature in the 2.1.x firmware where you can set the time on a SPA phone GUI and it will then update the system time.  Alternatively, if you have a LAN side NTP server that is on the same subnet as your Data VLAN subnet, you can use the NTP.pmf file found here:  https://supportforums.cisco.com/docs/DOC-16301
    Upload custom Music on Hold and Auto Attendant prompt files.  We are currently in beta of a new Cloud service.  To participate in the Beta, please send an e-mail to [email protected] requesting MoH/AA Custom files Cloud Beta participation.
    Caller ID on FXO:  Make sure that you have run the impedance matching tool on each of your FXO ports.  For additional information on running the Impedance Matching tool and Caller ID troubleshooting, please see the UC320W Troubleshooting Guide.
    CLI access -- This is for Cisco Support personnel only for low level debugging.  This is not a IOS based device and there is no command line access for provisioning.
    Cheers,
    Chris

  • How do I delete documents and data on the iPhone 5?

    I've been seeing responses such as turning it off, so I did. However I didnt change my memory at all and when I found out whats using it up it was message with (saved) next to it. So i deleted some conversations from other contacts, but it barely dropped to like 1 GB. I check and check to see what else is being used up and music I don't have a problem with and I always delete pics and apps, like google drive. Can someone tell me how can i delete even more of documents and data?

    gail from maine wrote:
    Hey, you said "sorry"! I think that is very nice....
    GB
    That is certainly a possible interpretation.

Maybe you are looking for