473,395 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Calendar class question

Z.K
I was wondering if someone could explain something that while not a big
deal, I would not mind understanding why. When I set the Month field
with the set command with the value 1 and then use get to read it back,
it reads it as 0 and not 1.

Z.K.
Jul 17 '07 #1
3 3035
Z.K wrote:
I was wondering if someone could explain something that while not a big
deal, I would not mind understanding why. When I set the Month field
with the set command with the value 1 and then use get to read it back,
it reads it as 0 and not 1.
This should not be. Please provide a complete example of what you are doing.

--
John W. Kennedy
"The first effect of not believing in God is to believe in anything...."
-- Emile Cammaerts, "The Laughing Prophet"
Jul 17 '07 #2
Z.K
John W. Kennedy wrote:
Z.K wrote:
>I was wondering if someone could explain something that while not a
big deal, I would not mind understanding why. When I set the Month
field with the set command with the value 1 and then use get to read
it back, it reads it as 0 and not 1.

This should not be. Please provide a complete example of what you are
doing.
This is the code. I enter a 2 for month and I get 1 using the get command.

Z.K.

-------------

GregorianCalendar d = new GregorianCalendar();

d.set(Calendar.DAY_OF_MONTH,1);
d.set(Calendar.MONTH,2);
d.set(Calendar.YEAR,2004);
d.set(Calendar.DAY_OF_YEAR,32);

System.out.printf("%d-%d-%d\nDayOfYear =
%d\n",d.get(Calendar.MONTH),d.get(Calendar.DAY_OF_ MONTH),d.get(Calendar.YEAR),d.get(Calendar.DAY_OF_ YEAR));
Jul 20 '07 #3
Z.K wrote:
GregorianCalendar d = new GregorianCalendar();

d.set(Calendar.DAY_OF_MONTH,1);
d.set(Calendar.MONTH,2);
d.set(Calendar.YEAR,2004);
d.set(Calendar.DAY_OF_YEAR,32);
Last I checked day 32 of the year was in february so Java does nothing
wrong.
Jul 23 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Miguel Dias Moura | last post by:
Hello, i am trying to create a .css file with several styles and apply them to the calendar control so i can change the look of: 1. Text Type and Format (Bold, Underline, etc) 2. Background...
1
by: Peter | last post by:
I have a dilemna. Currently I have created a custom calendar webcontrol that a user can select and will dump the date along with some specialized information set in the tooltip. It actually is...
3
by: | last post by:
Hi all, I am new to .net so I am still unsure how to do thing, but I have discovered a class called HebrwCalendar and I am so excited that I must ask if someone can help me. First, I assume this...
2
by: Kajsa Anka | last post by:
Before I re-invent something I would like to ask if there exists some code that can be used for create the HTML code for a calendar which I then can include on a web page. The module in the...
0
by: mathewgk80 | last post by:
HI all, I am having popup calendar Javascript code. But i dont know how it is connecting to asp.net code.. I am using asp.net,c#.net and also using 3tier architecture with master page.... I...
0
by: abhishekbrave | last post by:
Hi, I have to reuse the code given below for displaying a calendar according to the month and year specified by user ...currently this code is fetching systme date and genrating calendar for that......
4
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters...
1
by: abhishekbrave | last post by:
The code below is opening a calendar on mouse over in the same window. I need the calendar to be opened in new window. Have to fulfill this requirement urgentely so posting the whole code here. I...
1
by: swethak | last post by:
hi, i have a code to disply the calendar and add events to that. It works fine.But my requirement is to i have to disply a weekly and daily calendar.Any body plz suggest that what modifications i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.