gregorian-calendar

Java GregorianCalendar What am I doing wrong? Wrong date?

Hello I have a problem with GregorianCalendar. What is wrong in there? How outcome is 2010/6/1 and not 2010/05/31? package test; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static void main(String[] args) { Calendar cal = new GregorianCalendar(2010, 5, 31); System.ou...

XMLGregorianCalendar to GregorianCalendar and back - inconsistent results

Consider the output from the code below with and without the call to get Calendar.HOUR_OF_DAY: XMLGregorianCalendar cal = datatypeFactory.newXMLGregorianCalendar("1994-08-10T00:00:00Z"); System.out.println("Cal: " + cal); GregorianCalendar gCal = cal.toGregorianCalendar(); gCal.get(Calendar.HOUR_OF_DAY); // this line m...

How can i get the date from my calender data?

Here i am getting one Map. That map contain the Date of birth detail of person as a GregorianCalendar. For example My Map is {motherEmailID=null, coreType=Ticket, _NULL=null, additionalFaclitiesProvided=[], dateOfBirth=java.util.GregorianCalendar[time=585340200000,areFieldsSet=false,areAllFieldsSet=false,lenient=true,zone=sun.util.cale...

Simple conversion between java.util.Date and XMLGregorianCalendar

I'm looking for a simple method of converting between java.util.Date and javax.xml.datatype.XMLGregorianCalendar in both directions. Here is the code that I'm using now: import java.util.GregorianCalendar; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.X...

Java GregorianCalendar and Calendar misplace weekends, days in a month for August and September, 2010

I'm trying to use either Calendar or Gregorian Calendar to iterate and create a date grid. However, both of them seem to think that August, 2010 has 30 days, and that September 2 and 3 are weekends. It's as if the calendar has the wrong year, but I've tripple-checked that parameter. Here are some excerpts. startDate.set(2010, 8, 28);...

I'm having problems using dates in Android

I am trying to compare dates and I have found where my code goes wrong, but I don't know why. I am trying to compare a date with todays date (using Gregorian Calendars only). I have printed out todays date where ever it is mentioned in the code and in one place it magically changes from year 2010 to year 3910 (todays year + 1900). Doe...

How can I convert from Gregorian Calendar to Unix Time, in Java?

Hi, I am in need of a method to convert GregorianCalendar Object to Unix Time (i.e. a long). Also need a method to convert Unix Time (long) back to GregorianCalendar Object. Are there any methods out there that does this? If not, then how can I do it? Any help would be highly appreciated. Link to GregorianCalendar Class --> http://down...

Date issue with Georgian Calendar previous day date shown

I had some issue with date: I get the current date (2010-10-27) in NSDate,converting it to NSString ...it's k But again when I try to get the date from String i.e NSDate , I am always getting the day before date . i.e (2010-10-26) instead of getting (2010-10-27). Plz help me.....I tried alot for the same..with every possibilty Here is...