Calendar.getTime() broken?

Advertisement
Running the following code:
int hoursToMillisec = 3600 * 1000;
TimeZone tz = TimeZone.getDefault();
System.out.println("Default time zone id: " + tz.getID());
System.out.println("Default time zone: " + tz.getDisplayName());
System.out.println("Offset from GMT: " + (double)tz.getRawOffset() / hoursToMillisec);
System.out.println((tz.useDaylightTime()) ? "uses DST": "no DST");
System.out.println("DST value: " + tz.getDSTSavings() / hoursToMillisec);
System.out.println("Current time: " + Calendar.getInstance().getTime());
Outputs:
Default time zone id: America/Denver
Default time zone: Mountain Standard Time
Offset from GMT: -7.0
uses DST
DST value: 1
Current time: Tue Mar 18 13:51:45 MDT 2008
The problem is the current time is actually:
Tue Mar 18 12:51:45 MDT 2008
Advertisement

Replay

hmmm, when i run it, i get the right time.
public static void main(String args[]){
          int hoursToMillisec = 3600 * 1000;
          TimeZone tz = TimeZone.getDefault();
          System.out.println("Default time zone id: " + tz.getID());
          System.out.println("Default time zone: " + tz.getDisplayName());
          System.out.println("Offset from GMT: " + (double)tz.getRawOffset() / hoursToMillisec);
          System.out.println((tz.useDaylightTime()) ? "uses DST": "no DST");
          System.out.println("DST value: " + tz.getDSTSavings() / hoursToMillisec);
          System.out.println("Current time: " + Calendar.getInstance(tz).getTime());
     }I get the correct answer: Tue Mar 18 15:49:06 EDT 2008 And the time here is 3:49

Calendar sync broken Outlook 2007 and iPhone 4.1

If I add a new Calendar event on my iPhone, it does not synch over to Outlook Calendar. If I add new event to my Outlook Calendar, it does not synch over to iPhone. Same with deleted events. Everything else, including Contacts, syncs OK. The combinat

Calendar & TimeZone problem

Im developping a mobile application where the mobile devices and the SAP server are in a different timezone.  I have tried a couple of things to do that but nothing seems to work.. We are using: CrEme J2ME(tm) CrEme V3.25 (=> Personal Java 3.1) Mobil

Convergence 1u3 Calendar issue

I'm having a weird issue with Convergence. At some point something happened to where a user could no longer load or see their calendar from within Convergence. It was working at one point, but now they log in and when they click on the Calendar butto

E72 CALENDAR ALARM PROBLEM - PLS HELP

I am using a Nokia E 72. sometimes when I set alarm for anniversary event at 9.00 AM the alarm is saved for 14.30 hrs. If I try to edit the entry to correct the alarm time, then also it is being saved for 14.30hrs. Is it a bug in the SW? Are you also

Calendar Date Calculation

What's wrong with my following statement? I always get compilation, class XX Calendar calendar = Calendar.getInstance(); Calendar cal1 = calendar.add(calendar.MONTH,1); //incompatible types error Date expiry = cal1.getTime(); but I got the requiremen

Specific time in different timezones

Hello all, I have the following scenario. My developement pc is in a PDT timezone and my server is in a EDT timezone. Plus, the date entries in the server need to be GMT values. I know that, right now at least, there are 3 hours of difference between

Tomcat's performance

Hello there! A few time ago I found an error "OutOfMemory" and I solved this error with Tomcat's parameter JAVA_OPTS, I increased the server memory to 512MB like this: JAVA_OPTS='-Xms512m -Xmx512m' and it is working for one/two users.Can anybody

Apache Abdera deployment is not working in Weblogc9.1

Hi I am accessing Atom feed from one url(www.example.com.rss.xml). I wrote one servlet and deployed it in weblogic9.1 and Tomcat5.5. Weblogic deployement is not working. but tomcat deployment is working properly. My Code is : public void service(Http

Java.lang.IllegalArgumentException Error

Hi, Can anybody figure out why #urlencodedformat(encrypt(createdate(year(now()), month(now()), daysinmonth(month(now()))), 17))# causes the following error? Message [empty string] StackTrace java.lang.IllegalArgumentException at java.util.GregorianCa

How to supply values for searchCriteria items in af:query programmatically

Hi, Is it possible to supply the default values for search criteria items in af:query programmatically? I didn't find any of the method to set the values for the search criteria items inside the oracle.adf.view.rich.model.Criterion and oracle.adf.vie

Fetch Epoch time

Hi: I want to build a small java code that returns the unix epoch time for 12:00AM yesterday and 11:59PM yesterday. Anybody have code which does the above that you can share ? TIA RaviThis should do what you're looking for: import java.util.Calendar;

How can i compare:  java.util.Date oracle.jbo.domain.Date?

I have made a ViewObject wich contains a date column. I want to check if this date is smaller/greater than sysdate: i get following error: Error(45,24): method <(java.util.Date, oracle.jbo.domain.Date) not found in class Class4 code: SimpleTimeZone p

How to display calender

Hi, Iam developing a swings application..in that i have adate column..if the user selects a date feild then in tha corresponding value column it should display the month calender for date picking..so that he can select the date from that calender and

Compare date

hi all, the below code has one error in compare date : today >= expiredate. In this program, i want to compare if today is greater than expiredate, then status = overdue write to table named totalday. thanks Class.forName("sun.jdbc.odbc.JdbcOdbcDr

Disable daylight saving time

Hi all, I know this subject has been posted before, but i haven't found any suitable response. I need to disable daylight saving time, but i haven't been lucky yet. I've tried several things: // Option A Calendar calendar= new GregorianCalendar(TimeZ

Transfer parameters between JSP's

Hello there! I am having a JSP coordonate by a servlet. Look my servlet: package daciait.ges.commands; import daciait.ges.navigation.ICommand; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import daciait

Crystal Reports for eclipse 2.0 deployed on unix

Hi, We have designed few crystal reports using u201CCrystal Reports for Eclipse 2.0u201D on windows platform. We have embedded this report into a J2EE Web application and deployed the web application on Tomcat 6.X server. We are able to generate the

Looking for a "free" Date Picker

I'm looking for a free to download and use Date Picker that I can integrate into a small Swing app. Nothing fancy, just a calendar (probably using a JTable) and the ability to select a day of year/month and (possibly) a time of day. I'm searching goo

How can i get current time in different TimeZone

Hi alls, How can i get current time in different TimeZone. I've tried final Calendar calendar = Calendar.getInstance(GMT0_TIME_ZONE); final Date date = calendar.getTime(); but it returns current time in my time zone not in GMT0a simple way would be:S