GregorianCalendar: I seem to always be five (5) hours head in my value.

The following just outputs the milliseconds of the current datetime in Central Standard Time (CST).
What I am try to test is this line:
calendar.add(Calendar.HOUR_OF_DAY, 0);When I try the following:
package test;
import java.util.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.SimpleTimeZone;
import java.util.TimeZone;
public class GetCal {
     public static void main(String args[]){
          String[] ids = TimeZone.getAvailableIDs(-6 * 60 * 60 * 1000);
          if (ids.length == 0) {
              System.exit(0);
          System.out.println("Current Time");
          SimpleTimeZone pdt = new SimpleTimeZone(-6 * 60 * 60 * 1000, ids[0]);
          // set up rules for daylight savings time
          pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
          pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
          Calendar calendar = new GregorianCalendar(pdt);
          Date trialTime = new Date();
          calendar.setTime(trialTime);
          calendar.add(Calendar.HOUR_OF_DAY, 0);
          long nCalTime = calendar.getTimeInMillis();
          String nCalTimeValue = String.valueOf(nCalTime);
          System.out.println("Long " + nCalTime);
          System.out.println("String " + nCalTimeValue);
}I would output something similar to:
1149624386040
I would take this value and run it in the following SQL to verify the datetime:
VARIABLE millis NUMBER
EXEC :millis := 1149624386040;
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH:MI:SS AM';
SELECT TO_DATE('197001','YYYYMM') + (:millis / 1000 / 60 / 60 / 24) converted
FROM DUAL;The result would be:
06-JUN-2006 08:06:26 PM
However, the actual time would be:
06-JUN-2006 03:06:26 PM
Thus, I am five hours ahead.
Since I am adding zero (0) in:
calendar.add(Calendar.HOUR_OF_DAY, 0);I thought I should get the correct time, however I always seem to be five hours ahead.
I'd greatly appreciate any help or corrects.
Thank you,
--Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

DrClap: I greatly appreciate your help with this.
I ran the following:
select DBTIMEZONE from dual;This returned "-06:00".
In a nutshell, I am testing with the current date - but what I have is a JSF MyFaces Calendar component that represents a date and a JSF listbox with the values 0 - 23 as hours options.
A user will pick a date and select an hour.
I have converted the date to milliseconds, add the selected hour and the resulting value needs to be in milliseconds.
This value will be passed to a method that will return a list of transactions for the user's picked date and selected hour. I have no control of the method - I am only consuming.
I am testing with the current date, to make sure everything is converting to milliseconds correctly - which it's not since I seem to be five (5) hours ahead.
Now that I know that the Oracle database server as a DBTIMEZONE value of "-06:00"; do I just create a static variable of (5 hours) 18000000 and just subtract that from the millisecond value that is made up of the picked date and selected hour?
There has to be a better way?
Thanks,
--Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Garageband seems to always crash on my iPad2 running IOS 5.

    Garageband seems to always crash on my iPad2 running IOS 5,  I have deleted the application 3 times so far and every time I lose my work  and uploaded it again and I keep on losing my tracks, I saved the tracks to iCloud but I can't seem to find them in the iCloud account, Someone please explain me this issue! and what am I doing wrong?
    thanks in advance.

    Garageband seems to always crash on my iPad2 running IOS 5,  I have deleted the application 3 times so far and every time I lose my work  and uploaded it again and I keep on losing my tracks, I saved the tracks to iCloud but I can't seem to find them in the iCloud account, Someone please explain me this issue! and what am I doing wrong?
    thanks in advance.

  • I invite people to an event I create on iCal, but in the invitation message received the invitees, the event seems to be scheduled for one hour earlier.

    Hi, no matter what setting I change, I am having the same problem.
    I invite people to an event I create on iCal, but in the invitation message received the invitees, the event seems to be scheduled for one hour earlier. E.g, I create the event for 14:00 GMT, yet the invitation message says 13:00 GMT. We are in the same time zone with the other people receiving the message. And I have my iCal settings as well as iCloud settings set to GMT.
    Can you please help me? I'm really frustrated!

    What exactly are you doing and what version are you using with OS X 10.8?

  • Is anyone having a problem with the new iPad (Gen. 3) not staying connected to the charger? It seems to ALWAYS get jiggled loose and no longer be charging. My iPad 1 has no issue but I can't browse Internet w/o new iPad unplugging. Horrible!

    I notice that my new IPad (3rd generation) will not stay connected to the power cord at all, I'm not exagerating, if I plug it in and browse the Internet without fail it will become unplugged and I will have to push the plug back in (Ba-beep). Ive actually grown to despise that sound when you plug your iPhone or iPad in because it reminds me of how much money I spent on something that PHYSICALLY will not charge while I'm using it.
    I know the problem with it holding a charge while in use, I get it, the screen is amazing and it takes a lot to run the display, however, it is unacceptable to me that I can't even keep the thing plugged in while I'm using it. I can not even leave it on my Cal King bed overnight because I will wake up in the morning to find that the plug has been jiggled loose in a corner, so it's still attached but not making a connection thus not being charged. 
    I love the 4GLTE from Verizon and I love the iPad, but I'm actually using my 1st generation IPad while I am at home so I can leave my new $900 iPad on a table to charge free of incident so I can use the 4G while I'm away from wifi during the day. I have been getting more upset about this because I can not even use the Griffin extended cord to charge the iPad and be far from the plug because only the original apple sync/charge cord will have a better shot at staying in. Absolutely none of my non apple cables will stay in the iPad 3 while having it in my hands.
    The plug is at an angle, unlike the first iPad, not sure about the iPad 2. Please let me know if they have same issue.
    If anyone else is having this problem with the Gen 3 iPad please let me know because I'm tempted to do something about it with apple and I'm hoping that I just for some reason have a bad cable receiver or something and maybe I can get a replacement and enjoy the iPad as I had expected to. There is no reason why I should be even using my first iPad and I have friends that want to buy it but I am not selling it because I'm unable to sell it because I can't handle the new iPad while it's plugged in, that is ridiculous if it's a common issue so please let me know!

    Thanks for the swift reply, I have been looking online and a loose plug seems to be somewhat of an issue with many, I hope mine is actually a problem and not what others are experiencing. It's taken me this long to even reach out for the simple fact I HATE being a complainer but this is just horrible.
    Do you have an iPad 3 as well? And is yours not experiencing any issues close to mine?
    Thanks again!

  • ITunes Resource files seem to always need permissions repair.

    Hey All,
    The subject says it all; when doing a permissions repair, Disk Utility finishes with a very long list (31 pages) of iTunes files and resources that have been repaired. This includes files in differing languages (Dutch, English, French, German, Japanese, Spanish) as well as CD settings (I don't burn CD's with iTunes). Many other file types are included in the list.  This happens repeatedly. Seemingly everytime that I do a permissions repair.
    On the last permissions repair, there were also a couple of iChat files and a Java file (not that it makes any difference, but I'm sure someone would ask).
    iTunes version 11.1 (126)
    Thanks in advance for any assistance.

    I just saw this post:
    https://discussions.apple.com/message/23192166?tstart=0#23192166?tstart=0
    if it's any help.

  • Shuffle mode seems to always play similar/same songs

    I don't know if its my imagination but when I use shuffle mode it seems to play similar or the same songs. Often I don't hear a lot of the music I know is there (1500+ songs). I've tried just restarting shuffle a few times which seems to start a shuffle at a different point.
    Does anyone know if shuffle changes its variety of songs when its used or does it tend to repeat the same shuffle sequence.
    Thanks

    I don't think its your imagination, I have noticed this also. There are many posts about this issue.
    I have created a smart playlist for Not Played, and I shuffle from that when I want to hear different music.

  • My laptop is getting very hot and the fan seems to always be on. The battery dies quickly too.

    Mac Pro 4 + years old. Bottom getting hot. Fan seems to run constantly when in use, or when charging. The charge does not last longer than 2 to 2.5 hours. Unplugging seems to cool it off as well as shutting down.

    Pre-Mavericks
    Open Activity Monitor in the Utilities folder.  Select All Processes from the Processes dropdown menu.  Click twice on the CPU% column header to display in descending order.  If you find a process using a large amount of CPU time (>=70,) then select the process and click on the Quit icon in the toolbar.  Click on the Force Quit button to kill the process.  See if that helps.  Be sure to note the name of the runaway process so you can track down the cause of the problem.
    Mavericks and later
    Open Activity Monitor in the Utilities folder.  Select All Processes from the View menu.  Click on the CPU tab in the toolbar. Click twice on the CPU% column header to display in descending order.  If you find a process using a large amount of CPU time (>=70,) then select the process and click on the Quit icon in the toolbar.  Click on the Force Quit button to kill the process.  See if that helps.  Be sure to note the name of the runaway process so you can track down the cause of the problem.

  • Is a Premiere CS5.5 download available? I seem to always get redirected to the newest version, which is not supported by my OS. This is for first-time use, not replacement download of an already-purchased product.

    OS is Windows Vista Home Premium. Any help would be greatly appreciated.

    CS5 is not for sale any longer if you are looking to purchase it, at least not thru Adobe.
    CS6 is still being sold.  I run CS6 on a Vista system without any issues.  You might try downloading the trial version and see if it works for you.
    You can download the trial version of the software thru the page linked below and then use your current serial number to activate it.
    Be sure to follow the steps outlined in the Note: Very Important Instructions section on the download pages at this site and have cookies enabled in your browser or else the download will not work properly.
    CS6: http://prodesigntools.com/adobe-cs6-direct-download-links.html

  • EJB - MDB and Session and Entity - Seem to always run under same Thread

    I am working on an application that implemets a connection from an MDB to a Session EJB which inturn connects to a Entity EJB. All connections are impemented as Local Home. I use log4j for tracing and notice that the thread ID reported for all activity is the same "Thread ID: MessageListenerThreadPool : 0" .
    This confuses me because I thought that all EJB's would execute under different threads. Have I done something wrong? Have I missinterpreted the EJB implementation? Any opinions would be greatly appreciated!!

    Hi Kelly,
    This is a slight misinterpretation of the EJB threading requirements. There are a couple different issues as play here. First, the main threading guarantee made by the spec is that a particular instance of an EJB will not be invoked by the container on more than one thread at a time. This is one of the guarantees that simplifies the EJB programming model so that developers don't have to do anything special (e.g. the use of synchronized blocks) to handle concurrent access. Second, the EJB Local programming model requires that invocations have pass-by-reference semantics. Of course, the easiest way for the container to provide that behavior is to literally make the local invocation on the same thread.
    The call-flow you're describing touches a single instance from three different beans, so the threading guarantee is not violated. Hope that clears things up a bit.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Does the iphone 4 play stereo or mono sound? mines seems to always play through the headphones in mono :/

    When i play music through the headphones and through the car stereo it plays sound in mono. I was just wondering if this is what the iphone does or is mines broken?
    Thanks

    Make sure "mono audio" isnt turned on under: Settings - General - Accessability

  • My fans seem to always be on...why?

    I'm using my Macbook either at a desk or on a bed and for some reason lately my fans have been running a lot. 60-80% of my experiences recently have been with the fans on full blast. Why is this? What can i do to make fan usage normal again?

    Open *Activity Monitor* when this occurs and see what is using up percentage of your CPU. Be sure at the top to choose *All Processes* so you can see what is causing this. Usually it is a print process that is running when it isn't supposed to be on my MacBook. If it is something you don't recognize you should be able to kill it with no problem.

  • My time capsule wi-fi seems to become inactive for an hour or two in the mornings?  on MBP and iphone? any ideas ?

    My time capsule works without any problems , most of the time..... seems around 7-8 am the wifi connection doesn't work. its hooked up to my AT&T Uverse router. it isn't a lion issue ( I am running lion on MBP) because I also see it on my iPhone 4s. any ideas of what could cause this ?

    What is the network layout?
    The Uverse router is also wireless? Is that turned off or bridged?
    The TC is bridged or running as the main router? Is the only wireless AP the TC?
    Does the airport actually get an IP address from the TC?
    If so,
    Open a terminal in the computer and ping the TC, and ping the Uverse modem/router.
    Ping the outside world address by name and by IP.
    Tell me the results of all of that.
    If you want to try and jump to a solution.. try setting fixed channels on the TC.. short names for wireless, no spaces, no special characters. pure alphanumeric. What does that achieve?

  • Why does my macbook screen saver clock always read the same hour?

    Clock always reads 7 pm but the minute matches the current minute

    A lot of goofy things can happen if you have changed certain preferences, or upgraded with non-standard settings in place:
    System Preferences > Languages & Texts > Formats ...
    ... set a plausible standard form, like US or UK or something familiar. Close the window and Save changes. Then set to your actual preferences. Close the window and Save changes again. Test.

  • Why always 100MB+ backup every hour?!

    Hi,
    Time Machine ALWAYS backs up over 100MB every hour for me. I don't get it. Even when I'm modifying almost nothing. It makes my machine run really slow while it is doing it too (backing up over wifi to Time Capsule).
    How can I find out what files TM is backing up to see if there is something I need to exclude?
    There's no way I'm always touching 100MB of data between hourly backups.

    Wangjammer5 wrote:
    Time Machine ALWAYS backs up over 100MB every hour for me. I don't get it. Even when I'm modifying almost nothing. It makes my machine run really slow while it is doing it too (backing up over wifi to Time Capsule).
    How can I find out what files TM is backing up to see if there is something I need to exclude?
    First, it may not really be backing-up 100 mb. TM makes an initial request for space, which for some reason is always high.
    Download the +Time Machine Buddy+ widget from: http://www.apple.com/downloads/dashboard/status/timemachinebuddy.html. It shows the messages from your logs for one TM backup run at a time, in a small window. Among other things, you'll see a message like +xxx MB/GB requested, including padding+, followed a bit later by +yyy files (zzz MB/GB) copied.+ Why xxx doesn't match zzz is a mystery, and speculation is that the padding is extra work space needed on the TM volume.
    That's interesting, but doesn't actually answer the question of what is being backed-up.
    Download the TimeTracker app, from www.charlessoft.com.
    It shows most of the files saved by TM for each backup (excluding some system files, etc.).
    There are some applications that cause large backups, often because they use a single file, often a database, to store their data. Entourage is a common one, so every time you send or receive a single message, the whole database is changed, and will be backed-up the next time. Apple mail, of course, stores messages individually to prevent this.
    So if you see things in TimeTracker that you don't understand, post their names here and somebody should be able to explain what it is, and how to minimize the impact.

  • IPad 4th generation charging seems too slow. After 7 hours started at 20%, now only up to 60%.

    iPad 4th generation seems to be charging too slowly. After 7 hours, started at 20%, now at 60%. Is there something I can do to speed things up?

    Do you have the iPad busy doing many tasks while charging, perhaps without your knowledge?  For example, do you have Bluetooth on, even though you are not intentionally using it?  Are you using geofenced reminders (e.g., "remind me to ... when I arrive home")?
    You can stop many tasks from running by double clicking the home button, seeing those tasks thar are currently running (displayed to the right of the home screen display), then swiping toward the top of your iPad the icon above the bottom one that shows the icon as it appears on your screen.

Maybe you are looking for

  • How to get Dynamic values from R/3 into dropdownlist of my WD appl

    Hi all, I have a requirement like, I have 2 dropdown boxes. The values should be populated from R/3, for this am using a BAPI. But how to get the values dynamically, plz help me or give give some PDF/blogs which are useful to my scenario. Thanks in a

  • Calling a stored procedure with an XmlType parameter.

    I am attempting to execute a stored function via a named query. The stored procedure has a single parameter of Oracles 'xmltype', and also returns an xmltype. For example this dummy function function testXML(xml_in xmltype) return xmltype is begin re

  • How do i transfer contacts from blackberry to iphone4s

    I have a blackberry for work that syncs with Lotus Notes for contacts.  How do I get those contacts on my iphone 4s?

  • Showing/Hiding icons in Module Pool

    Hi, I have the requirement to dynamically show/hide an icon (based on conditions) on the module pool screen. Please let me know as to how this can be done. Regards, Divya.

  • First Try and JSP with JavaBeans

    Hi: I've installed Tomcat 3.3.2, and have made no configuration changes. I'm trying to create a JSP that uses a JavaBean. This is my first attempt, and there's nothing exciting about my try. Below is the JavaBean, that compiles just fine: import java