Which date is smaller?

Hi,
I have the "effective_date" value retrieved from a databse.
I need to check if this effective_date is before or after today's date, and accordingly perform some calculations..
I have trouble finding out if this effective_date is before or after today's date.
This is what I got until now.
//get today's date
Date now = new Date();
DateFormat df1 = DateFormat.getDateInstance(DateFormat.SHORT);
String s =  df1.format(now);
System.out.println("Date in Short format: " + s); // this prints 7/18/06
DateFormat df = DateFormat.getDateInstance();
Date today = df.parse(s);  //convert string to date
//current_eff_date is the string value of "effective_date" stored in database
Date currentEff = df.parse(current_eff_date); //this value 5/30/2006 00:00:00
if (currentEff.before(today))
     System.out.println("Eff date is before current date");                                             
else
      System.out.println("Eff date is after current date");                    I get an error
java.text.ParseException: Unparseable date: "7/18/06"
     at java.text.DateFormat.parse(DateFormat.java:335)While I have my fomat as "mm/dd/yyyy", why do I get 7/18/06 instead of 07/18/2006?
How can I compare the 2 dates?

I had to change DateFormat df = DateFormat.getDateInstance(); to
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); in my previous posting.
The following snippet works.
//get today's date
Date now = new Date();
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
String s =  df.format(now);
System.out.println("Date in Short format: " + s); //7/18/06
Date today = df.parse(s);  //convert string to date
System.out.println("Today: " + today.toString());  //Today: Tue Jul 18 00:00:00 EDT 2006
//current_eff_date is string value of date in database
Date currentEff = df.parse(current_eff_date); //convert string to date
System.out.println("Eff Date: " + currentEff.toString()); //Eff Date: Tue Aug 01 00:00:00 EDT 2006
if (currentEff.before(today))
        System.out.println("Eff date before current date");                                             
else
        System.out.println("Eff date is after current date");

Similar Messages

  • Which data types I have to use.

    hi all,
    I was using DEC '9' for a variable.
    ie., tunni type DEC of length 9. For smaller values like 000000488225584 is ok.
    But for larger values like 000001048988458000000513871057 is going to dump.
    Please suggest me which data type I have to use.
    It should not be effect the performance.
    Thanks in advance.

    Hi,
    Try use numerical character (TYPE N).
    Regards,
    Charles

  • Which Data-Types can be used as Widget Parameters?

    Hi,
    I have been playing about with widgets (specifically widget parameters) for a while now.
    I've got to wondering, exactly which data-types can Captivate turn into widget parameters?
    So far I know that you can use:
    Numbers,
    Strings,
    Arrays,
    Objects
    and Booleans,
    as parameters.
    Which ones am I missing?
    I know some don't work, because I tried storing a MovieClip as a parameter and that didn't work.

    Hi Eccles,
    You can set all basic data types supported in flash viz.,
    1)Numbers
    2)Strings
    3)Arrays
    4)Objects
    Since in Action script , an Object can be anything (array , array of objects , array of objects which by themselves are array of objects and so on ) , you can virtualy send anything as widget params
    But there are two caveats to this
    1)Object References
    -Object References do not have any meaning once the swf is closed.But the widget params have to be stored across sessions.So If you send a reference as part of widget params it is not going to work.
    This is why sending a Movie Clip (which is actually a reference to an Object ) does not work
    If you want to send such things you will have to 'serialize' the object.
    2)Size of the Object that you send
    The size of the object that you send can have an impact on performance.And since any object that you send has to be converted into XML , objects like bitmaps can turn out to be huge and difficult to handle.
    This brings us down to this - you can send any object across as widget param as long as it is small and serialized.

  • Which data source of many to use, based on user entry of month

    Looking for hints relating to BEx queries inside the Web Application Designer's web templates.
    Currently a query is using 1 very, very large data source, such as payroll records.
    If data is divided into smaller portions, such as monthly data sources....
    How can we:
    - establish a link between the variable entry screen where the user selects 1 specific month and
    - force the query to return results from that 1 month's data source?  
    In other words, we are looking for a way to build intelligence into the query for it to make a decision about which data source to use, based upon the parameters that end user enters.... with the hopes that the process will return the results faster, because it has less data to weed thru to get to the results.
    Thanks.

    Hi Sharon,
    As U said the datasource is a huge one. Now let's say these datasource is feeding its data to only 1 cube IC1. After the data to the cube is loaded, there will be huge junk of data from the source, so, inorder to improve the reporting performance with respect to this cube you got different options of creating Indexes, Aggregates etc., on to this cube.  Again coming the BEx, there also U have other options to improve your query performance.
    As per your requirement, U want to display data with respect to a month which the end user enters. For this I guess U can have a variable entry for the time characteristic Calendar Month/Year. By this way, U can get the desired results for the query.  I suggest, U can even improve the performance by having range values (or) single value restrictions on the time characteristic Calendar Month/Year, if U are sure for which calendar months (or) years the data is to be queried upon.
    Hope this should serve your purpose.
    Regards,
    Syed.

  • How to find which date's dmp file is loaded

    Hi experts,
    I have many export dmp files for all the dates.I refreshed the database with Nov'8 th dmp file,now i want to conclude that which date's dmp file[Nov 8th or Nov 9th like that] has been loaded to my database.Is there any way to find out that details?
    Thanx in advance,
    Senthil

    I'm pretty sure there isn't, unless you simply create a small table in the database with the current sysdate in it, before you do your export.
    Also depends whats in your export - is it a full db?

  • How to find out which data control do the page layout components come from?

    hi,
    work in Jdev 11.1.2.3
    After have drag and drop data control into pages designer, how to find out which data control do the page layout component (such as a field in form layout) come from?
    --i cannot find data control related information in the property pallete for the page layout component.
    Regards.

    This information can be found in the page definition file.
    Select the field in the page and then click the binding tab.

  • How to find which data elements are used in ABAP program ?

    I wish to find out which data elements are used in some programs .
    Is there any DD table which stores this information ?
    I know we can go to program and look in fields, but do SAP stores this information somewhere ?

    Dear Kaushal,
    Please check the table <b>TRDIR</b>.
    Regards,
    Abir
    Don't forget to award points *

  • I have a sbc65ec which is a small Pcb with a ethernet por...

    I have a sbc65ec which is a small Pcb with a ethernet port with it you can monitor voltages, operate relays from your pc and it works fine locally  i.e on my home network, but I would like to moitor the pcb from my place of work, it can do this but I don't know how to setup the router to do this, I paste the section from the manual which explains what I a trying to do
    Viewing readings on the net!
    This demo has been created simply by connecting an SBC65EC board to a Billion ADSL Modem/Router. The router is then configured to make the SBC65EC a virtual server that is accessible via the internet. Most modern routers have this feature built in, and can be used. Note: The board used in this demo is running an older firmware. The new firmware has more options, and the NetBIOS name can be changed on the network settings page.Q. How do i do this with my router???
    Q. What do I type in the address bar of my browser to access the PCB (I Type http://mxboard/ when I use it on my home network)
    Message Edited by paulshirley on 11-03-2007 10:58 AM
    Message Edited by paulshirley on 11-03-2007 05:14 PM

    hi,
    Thanks for replying,
    The easy answer first the router is a linksys WRT54G.
    The network I am using ?? well this Box WRT54G hangs on my wall, its connected to a broadband modem, which is provided by NTL (Virgin) a cable joins the modem to the Linksys and my computer is fitted with a Msi wireless Lan card, I know this because I have a little icon on the bottem bar of windows.
    When I want to go on line I just open up internet explorer and if by magic I'm on the internet I have a laptop which also uses the signal from the linksys, from what I understand neither computer is a server I think? as I can operate either without the other on.
    As you can guess I know nothing about networks to make matters  worse i'm an electronic engineer shame on me.
    paul
    Message Edited by paulshirley on 11-04-2007 04:22 PM

  • Liquidity forecast report - On which date will Purchase order be reflected

    Dear Gurus,
    My client has payment terms ' payment 30 days after date of GR'
    say the Purchase Order is raised on 1/1/2009 and GR done on 20/1/2009 then amount should be due to vendor on 19/2/2009 ( 30 days from GR date)
    it is required that when i raise PO the said date should be reflected in liquidity forecast report.
    How can i make this possible as at time of raising PO i do not know GR date.
    Also let me know on which date the PO would normally be reflected in liquidity forecast report?
    Regards,

    Hi,
    I have a problem that none of the PO amount is reflected on cash liquidation, the report only retrieves balances of PO which have been converted to invoice through MIRO.
    I found that the configuration is complete, planning group has been assigned to vendor master data. Do you have any idea how planning level in Cash Management connects to Material Management/Vendor?
    Or is there something missing that I can't get balance of PO in cash liquidation report?
    Thanks a lot

  • To which data do apps have access to?

    Good morning,
    since I'm new to iOS (iPhone 5s with the latest OS if that makes a difference) I was wondering:
    Which data can apps access without my permission / knowledge?
    I know there are permissions which have to be given explicitly (like GPS) but are there also ones which are granted automatically without my knowledge? Are apps actually able to access the file system or any of my data outside the given permissions?
    Thanks a lot,
    Merowech

    Settings/Privacy
    You will see a list of apps that request access to the data.

  • How to detect which data type is passed in ?

    Hello!
     I've built a VI function. But I want to make it more secure - that function could detect which data type is wired to the inputs and allow wiring only certain data types. How can I do this?
     Thanks
    Message Edited by ACiDuser on 05-23-2009 08:13 PM
    Solved!
    Go to Solution.

    I'm assuming you're talking about numeric datatypes. In this case that information is not available to you at the subVI level. The LabVIEW compiler will have already changed the datatype to match what your subVI expects if someone wires something of a different type.
    You could use a variant as your input. Then in the subVI you can use the Variant to Flattened Data to get the type. The OpenG LabVIEW Data Tools VIs will be useful if returning an enum specifying the datatype. Specifically, using the "Get TDEnum From Data VI".
    Now that we've gotten that out of the way, let's talk about the why. Why do you need to do this? What are you trying to "secure"?

  • Which data we will store in infocube?

    hi experts,
    i am in little bit  confusion, i think this is basic level question.
    can any body tell me where we store analysed data. that means which data we will store in infocube( raw data or analysed data). which data we will use for reporting?
    please clear this confusion.
    thanks & regards
    venkat

    Hi Venkata,
    I have a basic simple understanding and explainantion. You get some raw data from a system such as R/3 which you apply transfer rules and transformations. Applying this will help us remove any inconsistencies, and standardizing the data we get from R/3. After this process, we have the data ready which can be stored in the Infocube/ DSO. Thus, Infocube contains data that is cleansed and standardized. Now, since you have the data ready, you design queries on the Infocube, which will generate reports according to the requirements. These reports will be used for analysis of all the data presented in the report through appropriate query.
    Hello All, Please correct me if i m wrong.
    Regards,
    Kunal Gandhi

  • Which Date for Sales Date in Demantra

    Hi Experts,
    For 'Shipment History – requested items –shipped date' option for collecting actual quantity, which date is picked from oe_order_lines_all table.
    I assume it is Actual_shipment_date . Initially I was thinking of scheduled_arrival_date
    or is it something else??
    If we are on weekly bucket, there will be some date parsing for Monday date ( day of week start)
    I assume this
    SALES_DATE = trunc(NEXT_DAY(Oe_order_lines_all.actual_shipment_date - 7 ,'MON'))
    Is my assumption correct?
    Thanks

    Hi MJ,
    Thanks for clarification
    If I use this for date compare, I should be getting correct dates right in my sql??
    SALES_DATE = trunc(NEXT_DAY(Oe_order_lines_all.actual_shipment_date - 7 ,'MON'))
    Thanks

  • Query data being picked from which data targets and dimension tables.

    Hi Guys,
    I need help from you people.
    My query is "If we execute any query, i want to know from which data targets and from which dimension tables data being read in the run time", is there any program or any table to find this data.
    thanks in advacne.
    Regards
    Prasad

    Hi Prasad,
    We will get Data target information in query level in information TAB.
    If you want get dimension tables information also you need use technical business content(bwstatistics) Cubes and need to customize the required information. I think standard statisics cubes is not provide dimention tables information. Need to customize that.
    Hope it will help for you.
    Thanks,
    Chandra

  • How to increase rate at which data is written to file?

    I have a program that reads data at 200kHz and I would like the program to write the data at the same rate. However, the fastest I seem to be able to get my program to write is about 5kHz. I have been using the DAQmx Read and the Format into File functions to read and write the data.
    I have tried moving the write function into a separate loop, so that the data would write to a file after the data collection was complete. However, this did not change the rate at which data was written to a file. Any suggestions for increasing the rate at which data is being to a file? Thanks for looking over my problem!
    Attachments:
    SampleWrite_Read.vi ‏58 KB

    Well, writing to a file is always slower since it takes some time to access the hard drive. I noticed in your program that you are writing into an ASCII file. That is also slower than if you write to a binary file. There are several examples that ship with LabVIEW that allow you to do High-Speed Datalogging (I actually believe that is the name of the examples). Those examples actually come in pairs, one does the datalogging, and another helps you read the file. I will recommend taking a look at them.
    The previous suggestions by Les Hammer is a great idea. Instead of acquiring 1-sample at a time, try acquiring 100 or 1000 samples and write them to the file.
    I hope that helps!
    GValdes

Maybe you are looking for

  • How to schedule a print job.

    OBIEE 10.3.4.1 on Redhat. We wish to schedule Answers and Publisher to print a certain report on a specific print. Can OBIEE do that? Thanks.

  • Exclude Title in Address End Address in Sap Script

    Hi All, We are using below code to print address of payer in check form but its printing the title also in address, Say Company etc. We donot need this. Is there any addition to this statement to remove this. ADDRESS PARAGRAPH E1 NAME        &REGUH-Z

  • Default Printing Issue

    Post Author: dipeshnepal CA Forum: .NET Platforms: Windows 2003 Server, Windows XP Service  Pack 2Application: Designed on Microsoft Visual Studio 2005Crystal Report Desinger: Crystal Reports for .NET Framework 2.0 When report in printed with any non

  • Convert to jpg

    How to convert many ai file to jpg? because export ai to jpg only convert 1 file, but i have many ai file, pls advise some method with Thanks

  • Need help on sap intial screen

    how to change sap intial screen and want to add my company logo there at right side.