Calendar can't set as (1970,3,5,2,59,59)

Hello,
When I tried to test my codes use these codes, I found if I set calendar as (1970,3,5,2,59,59). It can't get correct hour number. This problem is very strange.
Can any body tell me the reason? Is it a bug in alendar? I used Java 1.3
Thanks in advance.
Calendar cal = Calendar.getInstance();
cal.set(1970,3,5,2,59,59);
int hour = cal.get(Calendar.DAY_OF_MONTH);
System.out.println(cal.get(hour));
the result is 1 not 2

for starters, what the hell are you doing this for:
int hour = cal.get(Calendar.DAY_OF_MONTH);
System.out.println(cal.get(hour));you're getting the DAY_OF_MONTH field (ie a value between 1 and 31) and then using that random value to address the calendar object to retrieve something you are then assuming is the hour?!
Secondly, it sounds like your calendar is doing a locale adjustment or Daylight savings time adjustment. Read up on the GregorianCalendar and the TimeZone classes. It sounds like your system is setting a -1 hour offset TimeZone on the Calendar object.
McF

Similar Messages

  • Can you set different colours for invitees in calendar?

    In calendar on the iphone/ipad can you set any events that you accept from invitees to a different colour so that you can instantly distinguish them from your own events?
    Cheers

    You could choose None in Preferences > General > New Mail Sound and set up a rule for each account in Preferences > Rules as follows:
    If [any/all] of the following conditions are met:
    [Account] [AccountName]
    Perform the following actions:
    [Play Sound] [Sound]
    Problem is, that would cause the sound to be played for junk mail as well — probably not what you want.

  • ICloud: I can't set a check mark at calendar, contacts and mail. Why?

    iCloud: I can't set a check mark at calendar, contacts and mail. Why?

    I'm afraid so. The iCloud control panel is only compatible with Outlook 2007 or later.
    iCloud system requirements:
    http://support.apple.com/kb/HT4759
    However, you should still be able to add your iCloud mail account manually in Outlook using the server information.
    iCloud server information:
    http://support.apple.com/kb/HT4864

  • Can I set up family sharing for the calendar without paying for everyone's purchases?

    I would like to set up family sharing so we can share a calendar, see each other's location, etc. but I don't want to pay for everyone's purchases.  Can we set up family sharing without that feature?

    When you added the card, did it take a number of goes to get it accepted ? Each time that you add or change your credit card details on your account a small temporary store holding charge (i.e. $1) may be applied to check that the card details are correct and valid and that it's registered to exactly the same name and address as on your iTunes account - your card issuer should remove it from your card within a few days or so.
    Store holding charge : iTunes Store & Mac App Store: About payment card authorization holds - Apple Support

  • Can I set individual alerts (tones) for each calendar events/ reminders

    Can I set individual alerts (tones) for each calendar events/ reminders

    Thanks On my phone, these are the options under Menu>Settings & Tools>Sound Settings>Alert Sounds: 1. TXT Message 2. Multimedia Message 3. Voicemail 4. Emergency Tone  5. Missed Call . And under Service Alerts: 1. ERI 2. Minute Beep 3. Call Connect 4. Charge Complete 5. Software Update. So nothing there for the calendar. And options from the calendar that I can see are Add (here you can change the tone for one event or recurring event, but not set a default tone for the event alarm), View (gives you the options of viewing an existing event in more detail, adding a new one, and the same choices from the Options list on the first screen where you are viewing the entire month), and Options (1. lets you view weekly/monthly,  2. Go To Today  3. Go To Date   4. Search   5. Erase All   6. Erase All Old   7. Send.  So as far as I can see, there's no way to do it. I have been through all the Settings and Tools menus... and the Events menu. But...I have just discovered that if I delete ALL my alarms and change the Ringtone for the first alarm I set, that ringtone becomes the default ringtone. I will try deleting ALL my events and starting fresh with a new tone and see if that works!

  • How can i set my calendar start from Monday NOT Sunday like it is now?

    How can i set my calendar start from Monday NOT Sunday like it is now?

    Read this thread: https://discussions.apple.com/message/11501621#11501621
    For example, if you set the Regional format to United Kingdom, the days will be re-ordered but it will have other effects as well which you probably don't want.

  • Can you set alerts specific for different calendars so when you create an event, the alert for the event is already set?

    On google calendar if you had a calendar for work and one for school, you can set alerts for earch so when you add a class or work related event, the event is set with alerts for that calendar. Can you do that with iCal?

    Hi Steven,
    This is one of the reasons why I wrote Dates to iCal.
    As well as automatically syncing birthday dates from Address Book, Dates to iCal can sync anniversary and custom dates. It can set up to five alarms for each date in iCal and can also set different alarms for birthdays and anniversaries.
    Best wishes
    John M
    <hr/>As I sell software on my site and ask for donations, the Apple Discussions Use Agreement requires that I state that I may receive some form of compensation, financial or otherwise, from my recommendation or link.

  • Can i set calendar events to four weekly?

    Can I set calendar events to four weekly rather than monthly or fortnightly?

    in iCal double click the new entry after you make it, and it will pop up a new window where you can edit furhter settings like the alert and repeat settings.
    just choose 'repeat' and then custom, you can then choose any configuration of days ,  weeks etc, and on what day if you choose weekely, for example 'every 3 weeks on a wednesday'

  • With new software can not set appointments on calendar. How to do it now

    With new software can not set appointments on calendar. How to do it now

    I'm surprised you haven't received a prompt but you can register here (You don't have to register.) : http://docs.info.apple.com/article.html?artnum=61890

  • Can I set up a second calendar for business?

    I use icalendar for myself. Can I set up another icalendar that is independent from my own?

    Dave ipod wrote:
    Folks, a friend has a hard drive with 2K blues tunes. Can I set up a second library and load it on a separate iPod nano so that it won't mix with my current library?
    Thanks, Dave
    No.
    That would be illegal file sharing.

  • How can I set an event to repeat on a week day rather than a numerical day of each month?

    How can I set an event to repeat on a week day rather than a numerical day of each month? I see an option at the bottom of the repeat window .... but I cannot use it. Actually, when I try it freezes up my Calendar.
    Lorrene Baum Davis

    These scrrenshots are from Snow Leopard - I would think that Lion wouldn't be too much different.

  • I have 2 ipod touches on the same apple id account.  Can I set facertime up on both with different access emails?

    I have 2 ipod touches on the same apple ID/account.  My daughter uses one, and I use the other.  Can I set facetime up on each with different access email addresses (so that we don't get each others calls?)?

    I recommend that you
    Create a NEW account/ID for her using these instructions. Make sure you follow the instructions. Many do not and if you do not you will not get the None option. You must use an email address that you have not used with Apple before.
      Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card
    Use the new ID on her iPod but only for:
    Settings>Messages>Send and Receive
    Settings>FaceTime
    Settings>GameCenter
    and Settings>iCloud if you want her to have separate Contacts Calendar and some other things.    
    Continue to use the same/common Apple ID for Settings>iTunes and App stores so you can share purchases.

  • How can I set up various mailboxes in Mail on my iPad.

    How can I set up various mailboxes in Mail on my iPad.
    I am using a Pop account and don't want to change this setup.
    I use two devices to access the same email account but I am not experiencing any lockout issues.
    Mail is simply not giving me any options to create mailboxes and there must be a way of doing this.  If I can do it in my iMac, surely I can do the same thing on my iPad.

    -Tap "Settings" app,
    -Select "Mail, Contacts, Calendars" option on the left hand side,
    -On the right, under "Accounts" on top, tap "Add Account...",
    -Select one of the email service providers or "Other",
    -Under "Mail", tap "Add Mail Account",
    -A window pops up and enter your new email account details.
    -Repeat for new email accounts.

  • HT204053 Can I set up two iCloud accounts on my IPAD3 at the same time? If not how do you sign out of one to sign in to another?

    Can I set up two iCloud accounts on my IPAD3 at the same time? If not how do you sign out of one to sign in to another?

    Welcome to the Apple community.
    You can add more than one account to your iPad, but you can only have one primary account. Secondary accounts which you can add at settings> mail, contacts, calendars do not have all the features of a primary account such as photo stream.

  • My husband and I share one computer.  We want to be able to share the same music on our iPhones, but we don't want to share the same contacts and applications.  How can I set this up so we still share music, but everything else is separate on our iPhones?

    My husband and I share one computer.  We want to be able to share the same music on our iPhones, but we don't want to share the same contacts and applications.  How can I set this up so we still share music, but everything else is separate on our iPhones?

    Welcome to the Apple Community.
    iTunes and iCloud are different accounts. You can both use the same ID for the store login and share your music etc., and use different ID's to log in to iCloud, thereby keeping your calendars etc separate.

Maybe you are looking for

  • Movies trimmed using Quicktime not showing up in iPhoto

    My movies are .AVI. When I open Quicktime, and edit the movie, it saves it as .MOV, which is fine. The only trouble is that the old unedited .MOV version is the only one that shows up in iPhoto. When I 'Show File' in Finder, I see both the unedited .

  • Changing PGA / SGA

    We have had an error with unable to begin new thread. All connections to the db were denied. Requests were falling down. We flushed the shared pool and restarted the cc managers and users could then connect. We are using Windows 2003 server enterpris

  • How to hide SAP logo ?

    Hi , After login in the portal SAP logo comes in heading tab . How to hide that SAP logo?

  • Prevent Downloading files

    hi to all, i am creating one online tutorial portal using jsp and servlets in the MVC pattern.I have the voice file repository in which user can ear the voice files(wav,mp3) randomly and attend the test.The problem is when i open the browser the othe

  • 7.1.1 update battery draining solutions?

    Since updating to 7.1.1 my battery is depleted - not sure of solution?