Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

stepping through java GregorianCalendar Class wtf!!

  • 11-02-2004 8:06pm
    #1
    Registered Users, Registered Users 2 Posts: 261 ✭✭


    i had problem filling a vector with dates start at certain date and add 1 till i got the end date
    The problem is that when i get to a certain point it then throws illegal argument
    Exception i have step through it and cant find why it does this, maybe i need to difine the start date and end date better i managed to get it working by changing the date around a bit i think it some thing with start date being smaller then the end date any info would be good
    Code:
    Constructing new object:
    new TarifType(new GregorianCalendar(2004, 6, 5,0,0,0),
    new GregorianCalendar(2004, 7, 25,0,0,0),
    sePrices,"Super Economy");

    That objects constructer:
    public TarifType(GregorianCalendar startDate,GregorianCalendar endDate,Tarifs[] tarifsIn,String strTitleIn)
    {
    tarifPeriod.add((GregorianCalendar)startDate);
    int j= startDate.get(startDate.DAY_OF_MONTH);
    strTitle = strTitleIn;
    //While which checks if the start date is equal to the end date
    while( startDate.get(startDate.MONTH) != endDate.get(endDate.MONTH) &&
    startDate.get(startDate.DAY_OF_MONTH ) != endDate.get(endDate.DAY_OF_MONTH) )
    {
    //method that add 1 to the DAY_OF_MONTH field
    startDate.add(j, 1);

    //creates new GregorianCalendar to be inserted into the vector
    GregorianCalendar addEelment = new GregorianCalendar(
    startDate.get(startDate.YEAR )
    ,startDate.get(startDate.MONTH),
    startDate.get(startDate.DAY_OF_MONTH));
    //adds date to vector using siad method
    addDate(addEelment);

    }
    public void addDate(GregorianCalendar DateIn)
    {
    tarifPeriod.add(DateIn);
    }

    Code is a bit messed up i was trying every thing to get work
    i have it workish :ninja:
    just curious that the problem was and is :mad:


Advertisement