Hi there
According to the official (gregorian) calendar, the week number for 29/12/2008 is 1, because after the last day of week 52 (i.e. 28/12) there are three or less days left in the year. Kinda weird, but OK, rules are rules.
So according to this calendar, we have these boundary values for 2008/2009
28/12 is week 52
29/12 is week...
Ok, I'm officially stumped on this one. I have a GregorianCalendar object that I would like to determine if it is in the past, present, or future. So far, the Calendar#compareTo docs are confusing to me, in that I am getting erratic results. A simple test class will illustrate my problem:
import java.util.Calendar;
import java.util.Greg...
I want to be able to convert between the Gregorian and Julian calendars (note: not "julian date") using NSCalendar on the iPhone. How can I subclass NSCalendar to use the Julian calendar? I want to do this without regards for 1582 or 1752 or any given year.
...
I am doing an assignment and it involves using the GregorianCalendar. The specs say I need to use setLenient(false); how do I do this? I also need to set a constant date (1/1/2009) so that the first day of my program is always that.
It also says to access the day, month and year through this:
get(1) //returns the year
get(2) // returns...
Ok, I want to make my program print out the date: 1/1/2009
But this is what it prints out:
Thu Jan 01 00:00:00 EST 2009
From this code
GregorianCalendar startDate = new GregorianCalendar(2009, Calendar.JANUARY, 1);
public void setStart()
{
startDate.setLenient(false);
Date date = new Date(startDate.getTimeInMillis());
Sy...
GregorianCalendar startDate = new GregorianCalendar(2009, Calendar.JANUARY, 1);
SimpleDateFormat sdf = new SimpleDateFormat("d/m/yyyy");
public void setStart()
{
startDate.setLenient(false);
System.out.println(sdf.format(startDate.getTime()));
}
When I run this code, I get 1/0/2009. I also get the same thing when I change the ...
I have a program that needs to start on 1/1/09 and when I start a new day, my program will show the next day.
This is what I have so far:
GregorianCalendar startDate = new GregorianCalendar(2009, Calendar.JANUARY, 1);
SimpleDateFormat sdf = new SimpleDateFormat("d/M/yyyy");
public void setStart()
{
startDate.setLenient(false);
...
Hi guys,
How can I get date of last sunday of a year in C#?? Will gregoriancalendar class be of help?
...
I tried to do set date value to a PreparedStatement with default value but the value is sometimes returned as a JulianValue. For example (Assume spanBegin and spanEnd are null)
Calendar cal = new GregorianCalendar();
if (spanBegin == null) {
cal.set(0000, Calendar.JANUARY, 1);
spanBegin = cal.getTime();
}
if (spanEnd == null)
{...
Context: I notice that the major databases support only the Gregorian calendar. Thus, it would seem difficult to build a database app with anything other than the Gregorian calendar.
If you have ever used a non-Gregorian date in a database app, I would be curious to know the context of your use case.
For example, if you live in India, ...
I have an assignment that converts dates from one calendar system to another.
The documentation for GregorianCalendar seems to suggest that you can use dates with BCE years, but I have no idea how. If I simply make the year negative, i.e.
GregorianCalendar cal = new GregorianCalendar(-20, 1, 2, 3, 0, 0);
System.out.println(cal.getT...
How do a I take an input birthday string such as 02 26 1991 and make it into a Gregorian Calendar?
I tried parsing it first but it keeps giving me an error message so I'm not quite sure what I'm doing wrong. I also have other input data before this date. One is another string and one is a double value.
...
How do I take a birthdate entered by a user and turn into milliseconds so that I can calculate how old they would be on a different planet
Here is the code I have so far:
DateFormat df = new SimpleDateFormat("MM dd yyyy");
Date dateBirth = df.parse(birthdate);
Calendar calBirth = new GregorianCalendar();
calBirth.setTime(dateBirth);
...
What are the maximum and minimum values of a GregorianCalendar?
Are they in a constant like Integer.MAX_VALUE, or maybe GregorianCalendar.get(BLAH)?
In a nutshell, how can I create a GregorianCalendar instance with min/max value?
...
I'd like to make a method called "isBetween" returning a boolean, seeing if a GregorianCalendar date falls between two others. Alternatively, I'd like to just define operators of < and > for the class. I'm pretty new to Java, so I'm not sure....can I even do either of those? If so, how?
...
Following query gives a NullPointerException when complie it.
Query query = pm.newQuery(Festival.class);
query.setFilter("this.startDate == sDate");
query.declareImports("import java.util.GregorianCalendar");
query.declareParameters("GregorianCalendar sDate");
query.compile();
Class:
public class Festival{
...
private G...
hi,
I'm using a Gregorian Calendar to set a specific date and time to an application using the set function of the Gregorian Calendar. When i use the getTime() method, it gives me the right output however when i try to access the Hour_Of_Day and Minute it gives a wrong number.
Calendar time = new GregorianCalendar();
time.se...
Hey guys, I know this is a very simple question but I am new to Java so please bear with me. I have create a program that can calculate the time a book is due to come back after being issued! So please help me out.
Here is the piece of code that I have:
public void loan(int numOfDays) {
if( onLoan == true) {
System.out.print...
My class looks like this :
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
@PersistenceCapable(identityType=IdentityType.APPLICATION)
public class Contact_Info i...
Hi, I have a string value that contains or a Hebrew date, or a Gregorian date. How can I determine if it's Gregorian or Hebrew in C#?
...