Date always 1 hour fast

I am trying to get the current date and time in my application. I am able to do this using the code below.
The problem is that it works in jdk1.2.2 but when I use
1.3 (which is the runtime the end user will have) the time is always 1 hour fast.
//Use the default timezone & locale
Calendar cal = Calendar.getInstance();
Date aDatey = cal.getTime();
System.out.println("Calendar date is \t\t" + aDatey);
//Use date constructor
Date tempDate = new Date();
System.out.println("\n\nDate constuctor's date is \t" + tempDate);
//Check if the default TimeZone is correct
TimeZone t = TimeZone.getDefault();
System.out.println("\n\nDefault timezone is " + t.getID());
boolean b = t.inDaylightTime(aDatey);
if (b)
    System.out.println("\n\nTimezone IS in daylight savings time");
else
     System.out.println("\n\nTimezone Is NOT in daylight savings time");Java is using the correct TimeZone, but inDaylightTime always returns true, even during the winter months!
As I said above, this is not a problem in 1.2.2 (everything works)
To make things a bit more interesting during the summer moths inDaylightTime returns true, but the time is correct (not 1 hour fast)
I can't see any logic in what's happening, any ideas/experiences would be appreciated
Thanks!

Actually, it looks like this is bug 4177450
http://developer.java.sun.com/developer/bugParade/bugs/4177450.html
The interesting thing is that I'm running this under JDK 1.3, and it claims to be fixed in 1.2 FCS M. Hmm.
Here's a sample program with output:
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
public class DateTest {
public static void main(String[] args) {
System.out.println("Running Date Test");
Date d = new Date();
System.out.println("Date = "+d);
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL,DateFormat.FULL);
System.out.println("DF = "+df.format(d));
Locale l = Locale.getDefault();
System.out.println("Locale = "+l);
TimeZone tz = TimeZone.getDefault();
System.out.println("TimeZone = "+tz);
System.out.println("TZ Name = "+tz.getDisplayName());
tz = TimeZone.getTimeZone("America/Los_Angeles");
System.out.println("\nChanging TZ to America/LA");
System.out.println("TimeZone = "+tz);
TimeZone.setDefault(tz);
System.out.println("Date = "+d);
Running Date Test
Date = Thu Sep 20 11:12:56 GMT-08:00 2001
DF = Thursday, September 20, 2001 11:12:56 AM GMT-08:00
Locale = en
TimeZone = java.util.SimpleTimeZone[id=Custom,offset=-28800000,dstSavings=3600000,useDaylight=false,startYear=0,startMode=0,startMonth=0,startDay=0,startDayOfWeek=0,startTime=0,startTimeMode=0,endMode=0,endMonth=0,endDay=0,endDayOfWeek=0,endTime=0,endTimeMode=0]
TZ Name = GMT-08:00
Changing TZ to America/LA
TimeZone = java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=3,startDay=1,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]
Date = Thu Sep 20 12:12:56 PDT 2001

Similar Messages

  • Date always display not accurate

    Hi
    I don't know why my display date always 1 day before the actual date. Let say the date value in database is 15-08-2006 in database, while I get the date and display it into my page, it always show me 14-08-2006.
    Is it this problem is related with the locale setting? will it also influenced by the server and client locale setting?
    I try to set the locale in faces-config.xml, but it seem like not effect on display the actual date. So may I know what problem I am, and how can i solved it properly?
    Thank you.

    I found the problem thanks google !
    The response is here :
    http://wiki.apache.org/myfaces/FAQ#Date
    And the solution is :
    Backing bean code :
    public TimeZone getTimeZone() {
              return TimeZone.getDefault();
         }JSP page code :
    <h:outputText value="#{hist.date_Crt}">
                             <f:convertDateTime timeZone="#{historyAction.timeZone}" />
                        </h:outputText>How difficult it was to solve this problem ! 2 hours to surf on the web for that !
    Thanks google ;).

  • Time is an hour fast

    Last night I noticed my iPhone screen said it was 8pm when it was really 7pm. I checked the Clock app and Cuppertino time (I live in Portland, OR) was 7pm. I checked my wife's iPhone and hers was an hour fast also. I also did a reset, no help.

    Hi Steve,
    This article: http://support.apple.com/kb/TS2339 describes that issue and provides tips that may resolve it.
    If you have checked Set Automatically in Settings > General > Date & Time, then you may want to contact AT&T as Tamara said.
    -Jason

  • My computer's automatic clock is six hours fast

    Ever since I updated to Leopard, my computer's automatic clock setting has been 6 hours faster than my actual time. I have it set in my region everywhere I can find it, anyone have a clue what could be wrong?

    Hi Mr.Mac
    Go to: "Apple / System Preferences / Date & Time / Date & Time" and uncheck the box "Set date & time automatically" them set the current time.
    Dennis
    Message was edited by: den.thed
    Oop's elmac; sorry for the cut's

  • GR posting date always greater than PO document date.

    Dear SAP Gurus,
    Am working on below requirement in a support project..
    Need to ensure GR posting date always greater than in PO creation date. Only current month is open for GR posting and at present as a standard system allows to post GR any date in the current open period.
    Is there any way, we can control the same via messages without implementing any exits or badis.
    Appreciate immediate response.
    Regards,
    GM

    there is no std sap for this
    you can use user exit to ful fill ur requirement
    in that u can write a code where is u can check all PO dated in GR must be eq to or less than GR posting and document date
    hope this helps

  • BPM data increase very fast and want to get suggestion about BPM capacity

    Dear BPM Experts:
    I meet a problem with BPM capacity problem. My customer using BPM 11g and every day they
    Have 1000 new process,every process have 20-30 tasks,they find the data increase very fast,about 1G/day.
    We have done a test about BPM capacity, I create a new simple process named simpleProcess.
    which only have three input field, I use API to initiate the task and submit to the next
    person.
    we using dev_soainfra tablespace, and we set the default audit level, after insert 5000 task, we find dev_soainfra is reach 362.375M,
    So as assume 30000 task will using 362*6=2G database spaces,and because in next phases,my customer want
    To push BPM platform to more customers, which means more and more customer will using this platform,so
    I want to ask is it data increase reasonable? Do you have capacity planning guide for BPM 11g? and If I want to reduce
    Lower The data increase, how can we do?
    We have try to turn the audit log off, but it seems useless, it only save 8% spaces.
    Thanks for your help!
    Eric

    It looks like you are writing your data to disk every so often.  For that reason, I recommend making it based on the number of samples you have instead of the time.  With that you can preallocate your arrays with constants going into the shift registers.  You then use Replace Array Subset to update your arrays.  When you write to the file, make sure you go back to overwriting the beginning of your array.  This will greatly reduce the amount of time you spend reallocating memory and will reduce your memory usage.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • When I send messages off-line, they enter in the addressed mailbox with the date and hour which I've clicked "Send later". How could I set up to the real time?

    When I send messages off-line, they enter in the addressed mailbox with the date and hour which I've clicked “Send later”. How could I set up to the real time?

    What you say about Send Later timestamp is correct.
    When you click Send or Send Later a time is set regardless of when you actually sent the Send Later email.
    Please voice your vote at this link:
    https://bugzilla.mozilla.org/show_bug.cgi?id=560901
    You will need to logon/register.

  • Extracting date and hour component from time stamp in diadem ?

    Hi all, 
    I am just getting started with DIADEM.
    I have a column with time stamp format as 4/12/2014  12:03:00 AM, i need to extract date and hour compenents only and store in another column.
    Can anyone please give me some lead on this?
    Please ask for extra infor if required

    Hi figured it out.
    I used this.
    str(chd(i,"P1_ACCH_1/Time_Stamp"),"#MM/DD/YYYY hh"))

  • Date Conversion hour incorrect

    Hi experts,
    Need help can't seem to understand why the hour is incorrect.
    Below query "dte_computation_on_data" is the old function they use to convert date and insert it to the table. Problem is when I revert it to the actual date the hour
    is incorrect.Need help. Thanks
    SELECT -- THIS HERE IS MY TEST TO REVERT TIME AND DATE ON THE FORMULA OF WITH RESPECT TO THEIR FUNCTION
    to_char(TO_DATE('19700101', 'YYYYMMDD')+(tb1.dte_computation_on_data/86400),'MM/DD/YYYY') || ' ' ||
    to_char(to_date(mod  (tb1.dte_computation_on_data,86400) ,'sssss'),'hh24:mi:ss ') revert_test,
    systimestamp,tb1.dte_computation_on_data
    from
    ( SELECT -- THIS IS THE FORMULA OF THE OLD FUNCTION THEY USE TO CONVERT DATE TO NUMBER AND INSERTED ON THE ROW
        floor((CAST(SYS_EXTRACT_UTC(systimestamp) AS DATE) - TO_DATE('19700101', 'YYYYMMDD')) * 86400) dte_computation_on_data
      FROM dual)tb1;
    results
    REVERT_TEST             SYSTIMESTAMP                            DTE_COMPUTATION_ON_DATA
    05/19/2011 03:46:18     5/19/2011 11:46:18.005171 AM +08:00     1305776778

    If you want the result in your local time instead of UTC, just add the difference using TIMEZONE_HOUR:
    select to_char(revert_test, 'MM/DD/YYYY HH24:MI:SS') as revert
    ,      to_char(now, 'MM/DD/YYYY HH24:MI:SS')         as now
    ,      dte_computation_on_data                       as comp
    ,      revert_test - now                             as diff
    from
    SELECT -- THIS HERE IS MY TEST TO REVERT TIME AND DATE ON THE FORMULA OF WITH RESPECT TO THEIR FUNCTION
           to_date(to_char(TO_DATE('19700101', 'YYYYMMDD')+(tb1.dte_computation_on_data/86400),'MM/DD/YYYY') || ' ' ||
             to_char(to_date(mod  (tb1.dte_computation_on_data,86400) ,'sssss'),'hh24:mi:ss'),'MM/DD/YYYY hh24:mi:ss')
             + (EXTRACT(TIMEZONE_HOUR FROM SYSTIMESTAMP) / 24) as revert_test
    ,      systimestamp as now
    ,      tb1.dte_computation_on_data
    from
    ( SELECT -- THIS IS THE FORMULA OF THE OLD FUNCTION THEY USE TO CONVERT DATE TO NUMBER AND INSERTED ON THE ROW
        floor((CAST(SYS_EXTRACT_UTC(systimestamp) AS DATE) - TO_DATE('19700101', 'YYYYMMDD')) * 86400) dte_computation_on_data
      FROM dual) tb1
    REVERT              NOW                       COMP DIFF
    05/19/2011 10:01:09 05/19/2011 10:01:09 1305792069 +000000000 00:00:00.522953Now there's only the milliseconds left as difference.

  • Sudden change date and hour

    Hi,
    yesterday I turned on my Mac and, after typed my password to login in, I found a warning icon telling that the date and the hour is changed to 01 January 2001, 03.05.00 (I don't remember very well the hour).
    So I adjust the date and the hour in the Date and Hour Setting, then I found that the computer asked to select the home wireless network as if it is the first time I used the Pc. Obviously I selected my wireless network with his password, and everything was fine.
    And today is fine.
    But my question is : this sudden change of date and network is work of a malicious cookie, or malware? Or a problem of the OS X?
    I am very careful with downloads from internet: I download only from well-known sites (as university, documents from my friends..), but should I delete the cookies from Safari and Firefox?
    Marta
    PS= before I write this post, I looked for information on my computer, but I don't understand much...

    First, it would be helpful to know what model of computer you have.
    Any time the date and time reset, it is likely because of an SMC reset. This can happen under several scenarios, the most common being that your computer lost power entirely. Current laptops have a coin battery in addition to the main battery that actually powers your computer. That way if the main battery dies, the coin battery still keeps the date and time settings. If the coin battery is bad (or if you have an older computer like an iBook or 12" PowerBook that doesn't have one) and your main battery dies, the date and time will reset.
    If you have an iMac, and your computer was unplugged or if your home was without power for a length of time, it's also possible for this to happen, but it depends on the model as to the specifics.
    It is not likely the cause of a 'malicious cookie or malware', Macs very rarely get viruses.

  • Transaction count for a Date and Hour

    Hi,
    We have a audit table called ALL_RT_AUDIT_MAP_RUNS which keeps number of transactions by jobs. We would like to find out, for a date, which Hour is having the maximum number of transactions.
    We have written the following query but it does not give 'which hour'? please help
    select Date_d,MAX(Tx_Cnt)
    from
    select trunc(end_time) Date_d,SUBSTR(TO_CHAR(end_time,'YYYY MM HH24 MI SS'),9,2)hr, sum(NUMBER_RECORDS_INSERTED) + sum(NUMBER_RECORDS_UPDATED) + sum(NUMBER_RECORDS_DELETED)+sum(NUMBER_RECORDS_MERGED) Tx_Cnt
    from ALL_RT_AUDIT_MAP_RUNS
    group by SUBSTR(TO_CHAR(end_time,'YYYY MM HH24 MI SS'),9,2),trunc(end_time)
    order by 1 desc
    group by Date_d
    Regards, Anirban

    What about something like this:
    select Date_d,MAX(Tx_Cnt)
    from
    select to_char(end_time,'YYYY MM DD HH24:MI') Date_d, sum(NUMBER_RECORDS_INSERTED) + sum(NUMBER_RECORDS_UPDATED) + sum(NUMBER_RECORDS_DELETED)+sum(NUMBER_RECORDS_MERGED) Tx_Cnt
    from ALL_RT_AUDIT_MAP_RUNS
    group by to_char(end_time,'YYYY MM DD HH24:MI')
    order by 1 desc
    group by Date_dBye,
    Antonio

  • Showing "current date - 8 hours" automatically

    Hi,
    For a report, I want to create two dashboard prompts. The second one should show the current date, and the first one should be "current date - 8 hours" automatically. For example;
    1. 5/11/2007 3:52:04 AM
    2. 5/11/2007 11:52:04 AM
    I can create the second one following these steps;
    “default to > variable expression” --> “@{system.currentTime}[dd/MM/yyyy hh:mm:ss]”
    What about the other? How can I create the first one?
    Thanks for your help, br,

    as SQL:
    select TimestampAdd (SQL_TSI_HOUR, -8, Current_Timestamp(0) ) from SubjectAreaName where TableName.ColumnName = 'some-existing-value'
    Note that -- from SubjectAreaName where TableName.ColumnName = 'some-existing-value' -- needs to evaluate to true.

  • Exif Date and hour data

    How to change Date and Hour (Exif or IPTC IIM)with Adobe Bridge CS3?

    Hi,
    I have the exact same problem - corrected the EXIF date and time and still wrong sorting. The thing is that Bridge sorts the files by "Creation Date", the date and time you also see in the Finder. So I found an application that can change that, too. But still Bridge sorts the files in the wrong order! Displays the old time, too.
    After several times of emptying the cache, sorting is now ALL messed up (without any kind of logic), I don't know how to fix it.
    Regards,
    Charles

  • Time Capsule backing up the same amount of data every hour?

    Hey there, anyone have this problem. My Time Capsule backs up 5.44 GB every hour. I can't find what it's backing up, but it's apparently backing up the same data every hour as if it's new or changed within the past hour. I'm not changing any data and it sitll backs up 5.44 GB of data every hour. Any ideas? Thanks!

    I just exlucded the entire Entourgage file from Microsoft Word 2008. Apparently that wasn't the problem though.
    Try excluding Main Identity
    Macintosh HD > Documents > Microsoft User Data > Office 2008 or 2011 Identities > Main Identity
    The entire Database file is in there. Any change at all to any email and the whole database will back up on the next pass.

  • Would installing Cheetah or Raptor drives make inDesign data merge work faster?

    Would installing Cheetah or Raptor drives make inDesign data merge work faster?

    I think SSDs might turn out to be slower. There are some other posts about major slowdowns when the OS and user profile are on SSDs.
    As a 32 bit program, ID can't adress all that extra RAM, so you won't affect the amount of swapping required. I don't really know how efficient an SSD is for constant read and write operations, but my undertanding is they work great for fast loading of things that don't change, but not so much for files that rewrite constantly.

Maybe you are looking for

  • SMTP chewing up bandwidth like crazy! Please help!

    I've got a crazy problem with a client's server. First, it's an xServe running 10.4.11 with all software updates. It's been in service as a WWW, Mail, FileMaker, FTP, AFP & Windows file server for several years now. Up until the other day, the machin

  • Instant client  on windows 2008 r2

    Hi, I've downloaded the zip files and followed the instructions here http://arswiki.org/wiki/Oracle_Instant_Client_-_Installing For some reason I can't launch sqlplus.exe as it keeps crashing. I just get Oracle SQL*PLUs has stopped working, check onl

  • Problem with InDesign CC exported epub for upload to IngramSpark

    I am completely frustrated with IngramSpark.  I have an epub file exported directly from InDesign and it repeatedly is being rejected by Ingram with the following message: Adobe Format Rejected - Invalid Metadata or Content File 04/10/2014 12:05:48 C

  • 22" ADC to an Xbox 360 with HDMI output?

    I have a 22" ADC Cinema Display, along with an Apple DVI->ADC adapter. Would I be able to connect my LCD to an Xbox 360 through HDMI to DVI (via an adapter)->DVI to ADC? The native resolution of my monitor is 1600x1024. If so, what would be the neces

  • HT201209 i forgot my security answers how to contact them ?

    i forgot my security answer for my itune id and now cant buy anything and still have money there .. any help?