Calendar object without time

Hi,
I need to get a calendar object without displaying the time (hh:mm) field. Can smone help me with this??
Thanks in advance

Thanks for the replies..but my requirement is a
calendar object which i need to set in one of the
existing bean class set methods which takes in only a
calendar object (I cant modify the method signature).
I am pasting my code below..
The situation is : I get data from database as a
string read from a file which is then converted into
a format yyyy-MM-dd using a simple date format. This
returns a date object which i need to convert to
calendar without showing the time fields. The prb is
it is showing the GMT diff as default.
public static Calendar dateString2Calendar(String s)
throws ParseException {
static SimpleDateFormat df = new
SimpleDateFormat("dd-MMM-yy");
static SimpleDateFormat df1 = new
SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();          
1 = null;
     Date d2 = null;
     String S1 = null;
     d1 = df.parse(s);
     S1 = df1.format(d1);
     d2 = df1.parse(S1);     
     cal.setTime(d2);     
     return cal;          
Req output : 2004-09-07
Current output : 2004-09-07+05:30
00:00 also not allowed in the output :(The Calendar object represents a particular moment in time - it does not have a format and it always has a time portion. Do not use the toString() method to display it - if you use the System.out.println() method to display it, the toString() method is being still being called. Format the display using SimpleDateFormat as suggested.

Similar Messages

  • How to retrieve Calender object without Time Zone.

    I need to Generate the xml file with JAXB. JAXB requires the Calendar class for the Calendar class. So i am converting the Date Object into the claendar Object as follows.
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(date) // date is the parameter
    return date;
    It was taking the default Time zone and creating the XML element as
    <Resource employmentType="Employee" externalId="104718"
    hireDate="2000-02-29+05:30" includeInDatamart="true"
    isActive="true">
    But i need hireDate="2000-02-29" without the time zone.
    In server side it accepts the "yyyy-mm-dd" formate only.

    I need to Generate the xml file with JAXB. JAXB
    requires the Calendar class for the Calendar class.
    So i am converting the Date Object into the claendar
    Object as follows.
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(date) // date is the parameter
    return date;use this
    //return date;
    return calendar.getTime();
    s taking the default Time zone and creating the XML
    element as
    <Resource employmentType="Employee"
    externalId="104718"
    hireDate="2000-02-29+05:30"
    includeInDatamart="true"
    isActive="true">
    d hireDate="2000-02-29" without the time zone.
    In server side it accepts the "yyyy-mm-dd" formate
    only.

  • Calendar object with Microsoft DST patch

    We have been testing changes to the 2007 daylight saving time. We applied Microsoft DST patch to Windows 2000 with Java 1.3.1_18 and Windows 2003 with Java 5.0 Update 8. On both systems the calendar object return time zone of GMT although the system clock is set for Eastern.
    If the Microsoft patch is removed, the correct time zone is again returned. Has anyone else seen this behavior when Windows OS patch is applied?

    > Does anyone know exactly what the problem is (what has Microsoft changed) ?
    a) Go to <http://www.ciac.org/ciac/bulletins/p-006.shtml> and search for the "CAN-" links. Each component has a one paragraph description.
    b) According to <http://patch-info.de/IE/2004/10/12/20-35-16.html> it contains:
    mshtml.dll (6,0,2800,1476 - 29,09,2004)
    urlmon.dll (6,0,2800,1474 - 23,09,2004)
    shdocvw.dll (6,0,2800,1584 - 27,08,2004)
    wininet.dll (6,0,2800,1468 - 23,08,2004)
    browseui.dll (6,0,2800,1584 - 22,08,2004)
    shlwapi.dll (6,0,2800,1584 - 20,08,2004)
    c) Some of the things that could be breaking are DOM references and DHTML, which are advanced features that not every application uses.
    From <http://www.microsoft.com/technet/security/bulletin/MS04-038.mspx>:
    "Caveats: Microsoft Knowledge Base Article 834707 <http://support.microsoft.com/?id=834707> documents the currently known issues that customers may experience when they install this security update. The article also documents recommended solutions for these issues."
    Among other issues, that page says [<b>emphasis</b> added]:
    - After you install the MS04-038 security updates for Internet Explorer, some dynamic HTML (DHTML) <b>drag-and-drop operations are blocked</b> by Internet Explorer.
    - Security update 834707 includes a change to the way that Internet Explorer handles function pointers. This change in functionality occurs when an event handler points directly to a Document Object Model (DOM) function [...] Change in Internet Explorer function pointer behavior <b>causes code to not be executed</b> when an event handler is set to directly reference a DOM function after installing MS04-038 security updates.
    BTW, Note 785308 has been updated with a workaround.
    Regards,
    Sean

  • Changing TimeZone for Calendar object doesnt change its time

    Hy, I have a Calendar object with I have set with a Date but I I want from this calendar with the Date set, set other timezone for this calendar and get the corresponding time(always gettting the correct time if is in daylightsavings) but I get the same time.
    Calendar calendario = Calendar.getInstance
    calendario.setTime(new Date());
    System.out.println(calendario.getTime()); *// for example I get the 14:12:25 hours for GMT+01:00*
    calendario.setTimeZone(TimeZone.getTimeZone("GMT+02:00")); *//change time zone using GMT*
    System.out.println(calendario.getTime()); *// I get the same hour: 14:12:25*
    Why? How to do it using GMT format?
    Thanks
    Edited by: user13162080 on 13-sep-2011 14:31
    Edited by: user13162080 on 13-sep-2011 14:48

    user13162080 wrote:
    Ok, thanks. The last question, this changing of timezone and the hour I am getting, is respecting the timezone daylight saving?, I mean if the TimeZone I set is in daylight savings, I will get the correct hour according to this?What DrClap said.
    However, I think you still may be under some misapprehension about time zones:
    1. A Date does NOT have a timezone, even though it stores a date/time value.
    2. Setting a Calendar's timezone does NOT change the time stored in the Calendar. You may even need to run its complete() or computeFields() method to have the timezone change reflected in all its fields (not sure).
    3. As DrClap said, if you are using a DateFormat to display the Calendar, you need to set its* timezone in order to see what you want (for reason 2 above).
    It's amazing to me that after 10 years this API still gives so many problems (and believe me, you're not the only one).
    One thing you might also want to do is have a look at [url http://joda-time.sourceforge.net/]Joda Time. It's been around for a long time now, and so is quite mature; and is fully interchangeable with standard Java date/time classes. In fact, many of its ideas were under consideration for Java Version 7 as JSR-310, but were decided against (still not quite sure why, as in my view the current API is very poor).
    Winston

  • Calendar Objects

    I have two questions. The first question follows the code and result information listed:
    Code:
    GregorianCalendar calendar = new GregorianCalendar();
    Date trialTime = new Date();
    calendar.setTime(trialTime);
    System.out.println(calendar.getTime().toString());
    System.out.println(calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
    System.out.println(calendar.getTimeZone());
    Result:
    Thu Jun 19 15:42:09 CDT 2003
    30
    sun.util.calendar.ZoneInfo[id="America/Chicago",offset=-21600000,dstSavings=3600
    000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=Americ
    a/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,start
    Mode=3,startMonth=3,startDay=1,startDayOfWeek=1,startTime=7200000,startTimeMode=
    0,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]
    Code:
    Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("CDT"));
    Date trialTime = new Date();
    calendar.setTime(trialTime);
    System.out.println(calendar.getTime().toString());
    System.out.println(calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
    System.out.println(calendar.getTimeZone());
    Result:
    Thu Jun 19 15:42:50 CDT 2003
    30
    sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,tran
    sitions=0,lastRule=null]
    QUESTION:
    For the most part, both of these gave me the same result; however, what is important to me is to receive 3:42 and not 15:45. I know I could parse the string; however, is there a way to force it to return 3:42 instead of the military time?
    The next question follows the code example:
    Code:
    // get the supported ids for GMT-08:00 (Pacific Standard Time)
    String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
    Code:
    // create a Pacific Standard Time time zone
    SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
    QUESTION:
    Both of the objects above acccept, what is referred to on the java.sun.com site, an int rawOffset. I used a loop to dump the ids out, only to receive different once depending on the number configurations in the formate of 'America/Chicago', etc. Can some explain to me how this number is calculated in relation to time or where I can get more detail on how to come up with the various number configuration based on the time zone I want?
    Thanks,
    corey
    [email protected]

    Thanks Steve and Nash. Both pieces of information were beneficial.
    The second questions would be kewl to understand. If anyone is aware of how these objects work, can you help me understand the results of the logic I wrote based on the data entered.
    I have the following code:
    // get the supported ids for GMT-08:00 (Pacific Standard Time)
    String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
    // if no ids were returned, something is wrong. get out.
    if (ids.length == 0)
         System.exit(0);
    System.out.println("TimeZone 1");
    int i = 0;
    String[] ids1 = TimeZone.getAvailableIDs();
    while (i < ids1.length) {
    System.out.println("ids " + i + ": " + ids1);
    i++;
    System.out.println("");
    System.out.println("TimeZone 2");
    i = 0;
    String[] ids2 = TimeZone.getAvailableIDs(-28800000);
    while (i < ids2.length) {
         System.out.println("ids " + i + ": " + ids2[i]);
              i++;
    System.out.println("");
    System.out.println("TimeZone 3");
    i = 0;
    String[] ids3 = TimeZone.getAvailableIDs(3600000);
    while (i < ids3.length) {
         System.out.println("ids " + i + ": " + ids3[i]);
         i++;
    Output of TimeZone 2:
    TimeZone 2
    ids 0: America/Dawson
    ids 1: America/Ensenada
    ids 2: America/Los_Angeles
    ids 3: America/Tijuana
    ids 4: America/Vancouver
    ids 5: America/Whitehorse
    ids 6: Canada/Pacific
    ids 7: Canada/Yukon
    ids 8: Etc/GMT+8
    ids 9: Mexico/BajaNorte
    ids 10: PST
    ids 11: PST8PDT
    ids 12: Pacific/Pitcairn
    ids 13: SystemV/PST8
    ids 14: SystemV/PST8PDT
    ids 15: US/Pacific
    ids 16: US/Pacific-New
    Now my question:
    Each of these loops put out a different list. Also, the -28800000 is a caluculation of the "-8 * 60 * 60 * 1000" listed in the TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000) object.
    I am trying to understand how this "-8 * 60 * 60 * 1000" is configured for different time zones considering that the output of this information is in the format of US/Pacific-New,etc...
    Basically with America/Chicago used as the notification for CDT, how do I determine the number configuration for the appropriate Timezone.getAvailableIDs parameters since I returned alpha numeric data as the result?
    Or does the TimeZone Object without any parameters define the Timezone based on the OS Time?
    Thanks for your feedback
    corey
    [email protected]

  • Is there a way to add event details using a calendar object vs. those dumb field entry boxes?

    I have switched from PC to Mac over a year and a half ago, and have been plagued with the "dumb" date entry boxes in iCal and now Reminders on the mac. For one, they don't show you the DAY OF WEEK for an event, it assumes you are parked on that day, but of course reality sets in and causes constant date changes for events. Picking a date in the future would be much more helpful if Apple followed some usability norms in iCal. For instance, if you are booking a flight online, those helpful little calendar objects pop up, and further, they are smart about "end dates and times" for events, knowing it can't be earlier than the start date. Apple iCal unfortunately always thinks you are creating an ALL DAY event, and when you change the start time, it creates the end time for the next day. Not very smart. Or is it me that is not very smart for constantly hawking every little data entry field for correctness. Why, oh why dear lord has Apple not given some usability attention to iCal on the mac??? At least match the interface of the iPhone with a nice little slot machine rolling control.
    Is there an add in?
    Is there hope that Apple will ever fix its lagging Mail and iCal apps on the Mac?
    Please advise. Or just offer a kind word of consolation if there is no hope for a better interface.

    In the future, Swing related questions should be posted in the Swing forum.
    The code you posted is of little use since it uses custom classes so we can't see the behaviour of your code.
    In general if you add a component to a Container at run time then you just use
    container.revalidate()
    This will invoke the LayoutManager and repaint the components in the container based on the new layout.

  • Urgent. Need help in the Calendar Object.

    Hello developers, best regards!
    Well my problem is that i'm facing a fact that i need a calendar object just like that one when u click the time down there in the taskbar, i need to embedd it in my java windows application.
    To be more clear, if u're familiar with the Visual Basic.NET environment, just the kind of calendars that i need is found there, in which it displays a small box which i can select the months, and accordingly i can select the specific date i need.
    Please i need your help so much.
    Thank you in advance.

    [url http://www.google.co.uk/search?hl=en&q=jcalendar&meta=]click

  • Date change problem in Calendar object

    Hi i have a calendar object for date representation.
    When i need to go ahead a day i use a add method that adds a day to the Calendar object, and if the date is out of range it adjustes proerly to the next montha and proper date in that next month.
    But it fails for 2 instances in a year.
    From May to June and From October to November.
    This i think is happenning because of the Daylight saving times in the May and October.
    I try to go from May to June but it never does on it's own !! Do i have to explicitly check that for those 2 months or there is any other method ?
    How can i get over it ??
    Please help me with this.
    Shailendra

    Hi
    There may be some other reason for it, coz Day light savings starts in last week of March, not in May.
    And day light savings ends in Last week of October
    Suresh

  • How to display Calendar view without having to select date

    Hi there,
    I would like to know can I display Calendar view without having user to select date first.
    And also, how do I highlight the date in calendar view for example, to show that i have set a reminder on that date?
    I have searched many threads before, but I could not get the final answer.

    Hi,
    Is there a way to display a full calendar popup with time stamp so the users can pick the timestamp from the popup?Date Picker doesn't have this feature. You can use Javascript to achieve the same. But at same time it's highly unrecommended to use javascript with OAF pages.
    Regards,
    Gyan

  • Calendar object being buggy

    Hi, I'm not new to Java, but this seems like the best place for this question: I have some code dealing with parsing and reading schedules:
           Calendar now = Calendar.getInstance();
              Calendar startDateTime = (Calendar) startTime.clone();
              Calendar stopDateTime = (Calendar) stopTime.clone();
              startDateTime.set(Calendar.YEAR, now.get(Calendar.YEAR));
              startDateTime.set(Calendar.MONTH, now.get(Calendar.MONTH));
              startDateTime.set(Calendar.DATE, now.get(Calendar.DATE));
              stopDateTime.set(Calendar.YEAR, now.get(Calendar.YEAR));
              stopDateTime.set(Calendar.MONTH, now.get(Calendar.MONTH));
              stopDateTime.set(Calendar.DATE, now.get(Calendar.DATE));
              if (scheduleType == 0) //weekly
                   for (int i = 0; i < schedule.length(); i = i + 3)
                        //System.out.println (TIMEFORMAT.format(startDateTime.getTime()));
                        startDateTime.set(Calendar.DAY_OF_WEEK, Integer.parseInt(schedule.substring(i, i + 1)));
                        stopDateTime.setTime(startDateTime.getTime());
                        stopDateTime.add(Calendar.DATE, Integer.parseInt(schedule.substring(i + 1, i + 3)));
                        System.out.println (TIMEFORMAT.format(startDateTime.getTime()) + " " + TIMEFORMAT.format(new Date()) + " " + TIMEFORMAT.format(stopDateTime.getTime()));
    ...My out put is:
    2008-11-24 09:47:00.000 2008-11-10 10:26:14.981 2008-11-27 15:00:00.000
    Which is not what I though I'd get (startDateTime and stopDateTime should be 2008-11-10, 2008-11-13).
    However, if I uncomment the "System.out.println(TIMEFORMAT.format(startDateTime.getTime()));" right after the if statement, my out put becomes:
    2008-11-10 09:47:00.000 2008-11-10 10:27:33.924 2008-11-13 15:00:00.000
    Which is what I want.
    This makes no sense to me, that System.out.println is apparently "changing" something. The closet I can figure is that System.out.println gives more time for something to do something. Shrugs.
    I figure I can bandaid it by setting the startDateTime/stopDateTime to (Calendar) now.clone(), and then setting the specific hour, minute, second to the stopTime/startTime instead, but this is really bugging me.
    Thanks for any help.

    I've been working with java for 4-5 years, and I'm studying CS for my major, so I thought myself at least not new, but I suppose if the experienced say so, then I guess my self-estimation was wrong. Well, this is a good reality check.
    Before anything else though, about what you said about .getTime() ("It is also setting startDateTime to the current time"). I'm under the impression that .getTime() get's the Calendar object's current time as a Date object (which as far as I've used, seems to be true) and also calculates the millisecond value. So if my Calendar is set to "January 2000", when I call .getTime() on it, do I get back a Date object set to "January 2000" (what I set it to) or "November 2008" (today's date)?
    As for the program, I read in a schedule, a start_time, a stop_time (as well as the schedule_id, but that's not important) from a database, and create a schedule object. Then in one method of my Schedule object I check if the current time is in the schedule. I create startDateTime and stopDateTime objects on the fly since if the program runs overnight to the next week, a startDateTime, stopDateTime created at initialization will be wrong.
    Here's a very heavily stripped down recreated version with a main and the test case I was using so you can run this.
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Date;
    public class Schedule2
         //date formatter
         private static final SimpleDateFormat TIMEFORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
         String schedule;
         Calendar startTime = Calendar.getInstance();
         public Schedule2(String schedule, Date startTime)
              this.schedule = schedule;
              this.startTime.setTime(startTime);
         public boolean nowInSchedule()
            Calendar now = Calendar.getInstance();
              Calendar startDateTime = (Calendar) startTime.clone(); //set the time values to correct values
              startDateTime.set(Calendar.YEAR, now.get(Calendar.YEAR)); //set the year/month/date values to correct ones
              startDateTime.set(Calendar.MONTH, now.get(Calendar.MONTH));
              startDateTime.set(Calendar.DATE, now.get(Calendar.DATE));
              for (int i = 0; i < schedule.length(); i = i + 3)
                   //System.out.println(TIMEFORMAT.format(startDateTime.getTime()));
                   startDateTime.set(Calendar.DAY_OF_WEEK, Integer.parseInt(schedule.substring(i, i + 1))); //sets current day_of_week to the one in the schedule
                   System.out.println(TIMEFORMAT.format(startDateTime.getTime()));
                   //when I check the startDateTime.getTime(), here is when I get the wrong date (2008-11-24 instead of the 10th)
              return false;
         public static void main(String [] args)
              Calendar a = Calendar.getInstance();
              a.set(1899, 12, 30, 10, 50, 0);
              Schedule2 sked = new Schedule2 ("203", a.getTime());
              System.out.println(sked.nowInSchedule());     
    }So in my test case, I had "203" as the schedule, meaning every Monday until Thursday (first digit is Monday, second two is the number of days the schedule lasts) and the start_time as "30/12/1899 10:50:00 AM".
    I expected to get back "2008-11-10" since this week's Monday falls on the second, but instead I got "2008-11-24".
    I did read the Calendar API, but I suppose I didn't understand it fully. .set() updates the fields, but not the millisecond value. So, maybe .set(Calendar.DAY_OF_WEEK, ...) is not doing what I think it is doing because the millisecond value isn't computed yet, and .set(Calendar.DAY_OF_WEEK, ..) seems more complicated than just setting straight YEAR/MONTH/DATE.
    I'm using Java 1.4.2 BTW.
    Edited by: Yi.Liu on Nov 10, 2008 12:57 PM

  • Calendar object issues ... recompute remaining fields after change?

    Hello all. I'm doing date manipulation and arithmetic, but I'm running into a problem.
    I'm taking a date provided by a user and comparing it the current date. However, it's the month-end that I'm interested in.
    I'm already creating GregorianCalendar objects from each one, and doing the set on the DAY_OF_MONTH field to the value from getActualMaximum(DAY_OF_MONTH).
    The problem I'm having is that when dealing two dates from the same month, the two Calendar objects are >NOT< returning as EQUAL. After converting each object to a Date and running compareTo() (Side Bar: Why isn't compareTo() available in the Calendar class?) I'm not getting zero.
    I tried a toString() on the two objects, and I can see that some of the fields are not exact ... the time field is "?", WEEK_OF_YEAR, WEEK_OF_MONTH are different, etc. I can see the protected method complete() in the API, but attempts to execute them (gcCurrDate.complete()) yield compile errors stating the method is not visible.
    So how does one ask the system to fill in the remaining fields?
    Thanks!
    Steve

    According to the API docs for Calendar:
    "set(f, value) changes field f to value. In addition, it sets an internal member variable to indicate that field f has been changed. Although field f is changed immediately, the calendar's milliseconds is not recomputed until the next call to get(), getTime(), or getTimeInMillis() is made."

  • How to access the remote Objects Without Db_links?

    Hi ,
    I want to know how to access the remote objects without db_link.That is i want to access a object in some other server which has different database.

    SanjayBala, just so you know that it is possible to create a database link in Oracle to non-Oracle databases in some circumstances. Look up Generic Connectivity aslo know as Heterogenous Services. With 11g Oracle has basically renamed the feature and replaced it with somethinkg named ike DG4ODBC.
    I have not spent time studying the details for DB4ODBC but with HS Oracle provided the interface and you had to obtain the necessary ODBC driver on your own. I had Oracle on AIX reading and writing to SQL Server on Windows but the developers chose to write a java program and connect to both via it. On Windows and Linux platforms the necessary ODBC drivers might be available without the requirement to go out and purchase one.
    The Oracle Open Gateway product is an advanced version of the above features with drivers for specific non-Oracle databases included like DB2 or Informix.
    HTH -- Mark D Powell --

  • Mozilla Firefox 32.0.1 caching objects without cache control headers

    Mozilla firefox is caching objects without any cache-control or expires header in response. The response does contain etag and date header but doesnt indicate anything about the duration it should be caching it. An example URL is https://www.priceless.com/content/dam/priceless/us/en/newyork/component/backgroundimages/NewYork_1920x596.jpg
    Am I missing something very obvious here.

    That is a beautiful picture. I understand that you are looking for a return header information about expiration. The about:cache page will show that information akaik there is a column information about expiration time. Some expire and some don't. I am pretty sure the later is the case you are seeing.

  • Get() for Calendar Object

    This may sound stupid, but I tried now for 3 hours without success:
    I created a Calendar "object"(textbox with date, button that allows you to select a date from a menu, and a little lable) with NetBeans design to get the users birthday.
    1. How to I get the date(or String) that the users selects(I tried getText(), getValue() and bunch of other stuff) from the calendar "object".(thus, should I do some conversions etc before retrieving the date.)
    I just want to get the date and save it as a String in the database.
    2. I noticed that you can just choose a date with a year from the current year onwards(thus you can't select for ex 1972). How do a change that for ex the last 100 years can be selected.
    Sorry for this common questions, but i am new to jsp.

    Are you using the JSF Calendar component as part of netbeans? The one referenced here?
    That link demonstrates how to set max/min dates.
    Saving a date as a String in a database? Why not actually save it as a sql date/timestamp? Why String?

  • Strange behaviour of Calendar Objects

    Hello folks, you may not believe it but I had a really strange behaviour in my Calendar Objects:
    I have 2 GregorianCalendar Objects, one instantiated by getInstance() for holding a reference for today and a second a user can pick which may or may not lie in the past. With some of my date fields it is allowed to have a past date, with others it is not, that is why I hold the reference for today.
    Then, for getting to know if the picked date is in the past I set the hours, minutes, seconds and milliseconds to 0 before comparing because I was just interested in the day not the time.
    And now comes what I cannot comprehend nor what I was able to fix:
    In the morning hours of the day I programmed this worked great. I gave it to our testers, and some days later I got it back on my desk, it would not work. I tested again in the morning, and it workd. I was confused, let it lay around a few days and tested again, this time in the afternoon. And it worked not ... now I was really confused. Just I had no time to fix it asap and put it aside for the next morning ... when it worked again ... ???
    So I started deep debugging ... and since I already got an idea it could have something to do with the daytime I worked on it in the evening.
    The debugging told me that the milliseconds of the 2 Calendar objects had exactly the same time and date, just different milliseconds in the evening and in the afternoon, but not in the morning. I cannot understand why, maybe one of you?
    I solved it by kicking the millisecond compare and compared year, month and day, so now it works. But it still confuses me why the milliseconds could have differed at all and why not in the morning but just in the afternoon and evening (both Objects are of the same time zone, I checked this, too).
    Rommie.

    I set the hours, minutes, seconds and milliseconds to 0...And you get different results in the morning and the afternoon? Okay, go to the API documentation and read about what the constant Calendar.HOUR means. Look just below it for another constant called Calendar.HOUR_OF_DAY and consider whether you should be using that instead.
    PC&#178;

Maybe you are looking for