ThinGraph timezone / dateFormat problem

Hey,
We're using BI Beans to display history statistics concerning security attacks/issues per day. Normally, the X-axis looks like this (dots act like spaces):
18....21....24....27....30....02....05....08....11....14
Oct 10............................Nov............................
A customer of ours complained last week about his graph labels on the X-axis to be displayed incorrectly. They sent a screenshot displaying the labels like this (*vertically* aligned underneath the X-axis, dots act like spaces):
2010-....2010-....2010-....2010-....2010-....2010-....
We were thinking this had to do with the daylight saving time switch of last week, so we started to investigate why especially this customer had problems and the others didn't. Then we saw that the Java timezone was set to Australia/Sydney instead of our software's default Etc/GMT. That seemed to be causing the problem described here. It appears that the Tasmanian timezone is the only Australian Timezone that shows the X-axis labels correctly.
We currently changed the customer's timezone to the one above, but what could be causing the dateFormat to be displayed incorrectly? It seems the Date objects are just printed out as 2010-10-18 hh:ss (only the '2010-' part is visible on the graph), instead of actually formatting them.
I already did a search on Google and this forum, but I can't seem to find any thread concerning the problem we have.
The version of the library we're using (and this in a Java 1.5 environment):
ComponentBuildVersion=3.2.2.0.24.2
ComponentBuildMode=nondebug
Copyright=Copyright ¬ 2001, 2005, Oracle. All rights reserved.
ComponentNumber=10.1.2.67.0
ReleaseDescription=BI Beans 10.1.2 Production Release
We're not actually defining a custom dateFormat in our XML configuration. We only use the predefined Oracle constants, which have always worked up until now, for the default timezone:
<Graph version="3.2.0.22" name="Graph" ... timeAxisTimeFormat="NONE" timeAxisDayFormat="AUTOMATIC" timeAxisMonthFormat="MONTH_SHORT" timeAxisYearFormat="YEAR_SHORT" graphType="LINE_VERT_ABS">
Anyone else had this problem?
Thanks and kind regards,
Jeroen

If you're in the states that value is probably correct. What you are looking at is the date and time "01 Jan 70 00:00:00 GMT" translated into your own time zone.
That's what 0 epoch time means.
If you want "now" do
Timestamp = new Timestamp(System.currentTimeMillis());

Similar Messages

  • Timezone & itune problem in iOS6

    I am having timezone & itune problem in iOS6 in ipad3.
    I earlier posted that when opening itune it's showing only a white screen.
    Then i got some reply's to chage year date to next year(2012) and then change it back.Then open itune
    or  logout and login of itune a/c.
    But both ways did'nt work for me.But now atleast it showing(cannot connect to itune)
    But i notice another problem that when i change my timezone to auto,it goes on serching and can't get fix on timezone as live in india(delhi).I don't think that should be a problem as i also have ipod which is working fine.
    May be both of this problem are related?
    can anyone help me in this or facing same problem ?

    I am having timezone & itune problem in iOS6 in ipad3.
    I earlier posted that when opening itune it's showing only a white screen.
    Then i got some reply's to chage year date to next year(2012) and then change it back.Then open itune
    or  logout and login of itune a/c.
    But both ways did'nt work for me.But now atleast it showing(cannot connect to itune)
    But i notice another problem that when i change my timezone to auto,it goes on serching and can't get fix on timezone as live in india(delhi).I don't think that should be a problem as i also have ipod which is working fine.
    May be both of this problem are related?
    can anyone help me in this or facing same problem ?

  • DateFormat problem xsd

    Hi all,
    I have an ESB project in which there is a file adapter. This file adapter reads files from a folder applying this files an xsd.
    In each file, there is a date which can be 22-FEB-2007 or 2-FEB-2007. The problem is the day, which can be a 1 digit number or a 2 digit number.
    In the xsd file, I have defined the date element like this:
    <xsd:element name="FechaFin" type="xsd:dateTime" nxsd:skipMode="before"
    nxsd:skip="20" nxsd:dateFormat="dd-MMM-yyyy hh:mm"
    nxsd:localeLanguage="es" nxsd:style="terminated"
    nxsd:terminatedBy="${eol}">
    </xsd:element>
    So, it works all right when the date in the source file is 22-FEB-2007, but gives an unparseable error when the date in the source file is 2-FEB-2007.
    I tried doing this:
    <xsd:element name="FechaFin" type="xsd:dateTime" nxsd:skipMode="before"
    nxsd:skip="20" nxsd:dateFormat=’"d-MMM-yyyy hh:mm” | “dd-MMM-yyyy hh:mm"’
    nxsd:localeLanguage="es" nxsd:style="terminated"
    nxsd:terminatedBy="${eol}">
    </xsd:element>
    which again gave an unparseable error.
    And also tried this:
    <xsd:element name="FechaIni"
    nxsd:skip="19" nxsd:skipMode="before"
    nxsd:localeLanguage="es" nxsd:style="fixedLength"
    nxsd:length="17">
    <xsd:simpleType>
    <xsd:restriction base="xsd:dateTime">
    <xsd:pattern
    value="([0-3])?[0-9][-][A-Z][A-Z][A-Z][-][0-2][0-2][0-9][0-9]"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    This works, I mean, the file adapter reads the file and gets the date but the element is a string, so, when i try to save that date in the database, it saves a wrong date. (string saved as date gives a wrong result)
    I also tried reading the date as a string, and after that, converting that string in a dateTime type in the xsl mapping file. But again didn't work. The date gets read as a string ok, and then in the mapping file the result is a blank element.
    Does anybody know how can I solve this problem? I really need help, don't know what else to do...
    Thanks a lot in advance.
    Zaloa

    Hi again,
    I tried to solve the dates problem using a simpleType definition with a union element inside. This way, it would be possible to parse one format or another, right? So this is what I wrote:
    <xsd:element name="FechaIni" type="tipoFecha" nxsd:skip="19"
    nxsd:skipMode="before"
    nxsd:localeLanguage="es" nxsd:style="fixedLength"
    nxsd:length="17">
    </xsd:element>
    <xsd:simpleType name="tipoFecha">
    <xsd:union>
    <xsd:simpleType nxsd:dateFormat="dd-MMM-yyyy hh:mm">
    <xsd:restriction base="xsd:dateTime">
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType nxsd:dateFormat="d-MMM-yyyy hh:mm">
    <xsd:restriction base="xsd:dateTime">
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:union>
    </xsd:simpleType>
    With this, if the file has 22-FEB-2007 or 2-FEB-2007, is read ok. The problem is that nxsd:dateFormat is not working in the simpleType element.I mean, the date is read as a string.
    Does anybody now how to solve this? Or where can I find nxsd:dateFormat documentation?
    Please, I need help with this. Thanks anyway,
    Zaloa
    Message was edited by:
    Zaloa

  • DateFormat problem in xsd

    Hi all,
    I have an ESB project in which there is a file adapter. This file adapter reads files from a folder applying this files an xsd.
    In each file, there is a date which can be 22-FEB-2007 or 2-FEB-2007. The problem is the day, which can be a 1 digit number or a 2 digit number.
    In the xsd file, I have defined the date element like this:
    <xsd:element name="FechaFin" type="xsd:dateTime" nxsd:skipMode="before"
    nxsd:skip="20" nxsd:dateFormat="dd-MMM-yyyy hh:mm"
    nxsd:localeLanguage="es" nxsd:style="terminated"
    nxsd:terminatedBy="${eol}">
    </xsd:element>
    So, it works all right when the date in the source file is 22-FEB-2007, but gives an unparseable error when the date in the source file is 2-FEB-2007.
    I tried doing this:
    <xsd:element name="FechaFin" type="xsd:dateTime" nxsd:skipMode="before"
    nxsd:skip="20" nxsd:dateFormat=’"d-MMM-yyyy hh:mm” | “dd-MMM-yyyy hh:mm"’
    nxsd:localeLanguage="es" nxsd:style="terminated"
    nxsd:terminatedBy="${eol}">
    </xsd:element>
    which again gave an unparseable error.
    And also tried this:
    <xsd:element name="FechaIni"
    nxsd:skip="19" nxsd:skipMode="before"
    nxsd:localeLanguage="es" nxsd:style="fixedLength"
    nxsd:length="17">
    <xsd:simpleType>
    <xsd:restriction base="xsd:dateTime">
    <xsd:pattern
    value="([0-3])?[0-9][-][A-Z][A-Z][A-Z][-][0-2][0-2][0-9][0-9]"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    This works, I mean, the file adapter reads the file and gets the date but the element is a string, so, when i try to save that date in the database, it saves a wrong date. (string saved as date gives a wrong result)
    I also tried reading the date as a string, and after that, converting that string in a dateTime type in the xsl mapping file. But again didn't work. The date gets read as a string ok, and then in the mapping file the result is a blank element.
    Does anybody know how can I solve this problem? I really need help, don't know what else to do...
    Thanks a lot in advance.
    Zaloa

    Hi again,
    I tried to solve the dates problem using a simpleType definition with a union element inside. This way, it would be possible to parse one format or another, right? So this is what I wrote:
    <xsd:element name="FechaIni" type="tipoFecha" nxsd:skip="19"
    nxsd:skipMode="before"
    nxsd:localeLanguage="es" nxsd:style="fixedLength"
    nxsd:length="17">
    </xsd:element>
    <xsd:simpleType name="tipoFecha">
    <xsd:union>
    <xsd:simpleType nxsd:dateFormat="dd-MMM-yyyy hh:mm">
    <xsd:restriction base="xsd:dateTime">
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType nxsd:dateFormat="d-MMM-yyyy hh:mm">
    <xsd:restriction base="xsd:dateTime">
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:union>
    </xsd:simpleType>
    With this, if the file has 22-FEB-2007 or 2-FEB-2007, is read ok. The problem is that nxsd:dateFormat is not working in the simpleType element. I mean, the date is read as a string.
    Does anybody now how to solve this? Or where can I find nxsd:dateFormat documentation?
    Please, I need help with this. Thanks anyway,
    Zaloa
    Message was edited by:
    zaloa

  • DateFormat  Problem by "recycling" legacy systems

    Folks,
    Congratulations to the Jheadstart development team!
    Now I am traing to "recycle" a legacy system and have problems with the German DateFormat 01.03.2005 and the expected dd-MMM-yyyy DateFormat...
    What should I do?
    Regards
    Boris

    Boris,
    When you generate an application with JHeadstart, you can specify the desired date format in the Application Structure File, at Service level.
    See also the JHeadstart Developer's Guide, Chapter 5, and look for date format. It tells you how to specify different formats for different languages.
    kind regards,
    Sandra Muller
    JHeadstart Team
    Oracle Consulting

  • Dateformat Problems

    I'm getting a wierd problem with dateformat, coldfusion
    version 6,1. I just installed the updater as well, but not sure if
    I now need to run it, or how to run it. There were mentions of this
    problem in the updater fixes, so it might well be down to that.
    If I need to run the updater can someone tell me how?
    Here's the issue anyway
    Can anyone tell me why this dateformat string works
    #DATEFORMAT("Mon, 23 Oct 2006 07:04 CDT", "m/d/")#
    I get 10/23
    While this one
    #DATEFORMAT("Wed, 18 Oct 2006 07:40 CDT", "m/d/")#
    gives me this java error
    Parameter validation error for function DATEFORMAT.
    The value of the parameter 1, which is currently "Wed, 18 Oct
    2006 07:40 CDT", must be a class java.util.Date value.
    I'm ouputting some dates from an rss feed and some dates
    work, and some don't, while they are all in the same format?
    Any help will be greatly appreciated.

    > The value of the parameter 1, which is currently "Wed,
    18 Oct 2006 07:40 CDT",
    Right. "Wed, 18 Oct 2006 07:40 CDT" is a string...
    > must be a class java.util.Date value.
    ... not a java.util.Date. So that explains the error.
    Although the error
    pretty much did that too ;-)
    As per
    http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000441.htm,
    dateFormat() does not take a string as its first argument, it
    takes a date.
    I suggest you attempt to parse your string with
    parseDateTime():
    http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000594.htm
    Then you can use the result in dateFormat().
    Adam

  • TimeZone, DateFormat & Daylight Savings time - help please

    Our system holds dates on the database as GMT. I need to display these dates in local times, taking into account time zone differences and daylight savings time. An example:
    DateFormat format = new SimpleDateFormat("HH:mm");
    format.setTimeZone(TimeZone.getTimeZone("Europe/London"));
    GregorianCalendar calendar = new GregorianCalendar(2003,6,31,13,20,25);
    System.out.println(format.format(calendar.getTime()));
    format.setTimeZone(TimeZone.getTimeZone("Europe/Istanbul"));
    System.out.println(format.format(calendar.getTime()));
    This code produces the following output
    13:20
    15:20
    What hasn't been taken into account is that both time zones are in daylight savings time so both dates should be one hour on. TimeZone has all the methods to establish and adjust the date so I'm surprised that the formatter doesn't use these. If I use them manually to adjust the date then everything works OK but I didn't think I'd have to do that. Anyone help me in getting the right results? Is this a bug or do I need to do something different? I'm using JDK 1.4.1
    Many thanks
    Ian

    I still can't get this working how I want. The date that I will be trying to parse will be a GMT date, not a BST date.
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
    TimeZone timeZone = TimeZone.getTimeZone("Europe/London");
    Date date = null;
    try {
    date = format.parse("2003-Jul-31 13:20:25");
    } catch (ParseException ex) {
    System.out.println(format.format(date));
    format.setTimeZone(TimeZone.getTimeZone("Europe/Istanbul"));
    System.out.println(format.format(date));
    format.setTimeZone(TimeZone.getTimeZone("Africa/Freetown"));
    System.out.println(format.format(date));
    This is the output
    2003-Jul-31 13:20:25
    2003-Jul-31 15:20:25
    2003-Jul-31 12:20:25
    My desired output is
    2003-Jul-31 14:20:25 GMT +1 hour DST
    2003-Jul-31 16:20:25 GMT +1 hour DST +2 hours time zone difference
    2003-Jul-31 13:20:25 GMT
    Any ideas?
    Cheers
    Ian

  • DateFormat problem

    Hi,
    I have the input date in my csv file as a string and I was able to convert into into the required format which is: "YYYY-MM-DDTHH:MI:SS"
    The problem when when my input date is in the format 01/22/2009 it works fine but when I have the date as 1/22/2009 or a 1/3/2009, it fails to transform (i.e., when MM and DD just M and D for single digit months and days).
    Can anyone please help me on how can I convert the input string to MM/DD/YYYY before I convert it to the required format.
    Thanks and appreciate your help
    -Prapoorna

    Hi,
         You can use nested substring Xpath functions and concat all these strings to form your standard format. I was facing similar problem to convert date from YYYY/MM/DD 00:00:00 to YYYY-MM-DDThh:mm:ss format.
         I have use the below mentioned code to convert the date format where $date is the input date variable.
    <db:P_X_DATE_FROM>
    <xsl:value-of select='concat(substring($date,1.0,4.0),"-",substring($date,6.0,2.0),"-",substring($date,9.0,2.0),"T",substring($date,12.0,8.0))'/>
    </db:P_X_DATE_FROM>
         I think you have to do the reverse thing here. You have to take two characters for both DD and MM incase of ‘01/22/2009’. In case of ‘1/22/2009’ or ‘11/3/2008’ you should take only one character.
         I think this information can help you.
    Thanks & Regards,
    Jyotirmoy.

  • TIMEZONE CONVERSION PROBLEM

    Hi,
    I have application which accepts a date-time and time zone as two different fields. I want to convert user entered date-time from user entered timezone to PST before storing it in DB. I am using below statement to do it -
    to_char(convert_time(to_timestamp(:P9_UPD_DHQA_DATE,'dd-MON-yy hh24:mi'),:P9_TIMEZONE,'US/Pacific'),'dd-MON-yyyy hh24:mi');
    -- with to_char converting timestamp with timezone type to varchar so that I can store it in timestamp field
    convert_time function code -
    create or replace
    function convert_time ( datetime in timestamp, tz1 in varchar2, tz2 in varchar2 )
    return timestamp with time zone
    as
         retval timestamp with time zone;
    begin     
         retval := from_tz(datetime, tz1) at time zone tz2;
         return retval;
    end;
    Reference - [http://www.devx.com/dbzone/Article/30501/0/page/3|http://www.devx.com/dbzone/Article/30501/0/page/3]
    sample data -
    :P9_UPD_DHQA_DATE : = '01-JAN-10 07:00'
    :P9_TIMEZONE := 'US/Eastern'
    Timestamp value in DB is stored as - 01-JAN-20 10.04.00.000000 AM (table column is timestamp type in DB)
    (observe year and hours)
    -- my SQL statement will look like this :
    update M7_DHQA_FEATURES set DHQA_SCHEDULED_DATE = :P9_UPD_DHQA_DATE WHERE id = APEX_APPLICATION.G_F10(i);
    But if I execute same SQL in SQL Work shop, I am getting below output -
    select to_char(convert_time(to_timestamp('01-JAN-2010 07:00','dd-MON-yy hh24:mi'),'US/Eastern','US/Pacific'),'dd-MON-yy hh24:mi') "dd" from dual;
    +01-JAN-10 04.00.00.000000000 AM US/PACIFIC+
    Another note is that if I execute update command with user entered value directly (i.e., without any timezone manipulations), I don't see any issues with year and hours.
    Can anyone tell me where I am going wrong and how to resolve the issue?
    Thanks,
    Krishna
    Edited by: user475761 on Jun 26, 2009 7:10 PM

    My page process complete code is below for any of those interested to look at code -
    FOR I in 1..APEX_APPLICATION.G_F10.COUNT LOOP
    if :P9_UPD_DHQA_STATUS <> 'No Change' then
    update M7_DHQA_FEATURES set RESULT = :P9_UPD_DHQA_STATUS WHERE id = APEX_APPLICATION.G_F10(i);
    end if;
    if :P9_UPD_DHQA_DATE is not null then
    :P9_UPD_DHQA_DATE := to_char(convert_time(to_timestamp(v('P9_UPD_DHQA_DATE'),'dd-MON-yyyy hh24:mi'),:P9_TIMEZONE,'US/Pacific'),'dd-MON-yyyy hh24:mi');
    update M7_DHQA_FEATURES set DHQA_SCHEDULED_DATE = :P9_UPD_DHQA_DATE WHERE id = APEX_APPLICATION.G_F10(i);
    end if;
    END LOOP;
    ---------------------------------------------------------------------------------------------------------------------

  • A dateformat problem!

    A date may be represented in the form : yyddd.
    For example, a date 01035 would represent 4 February, 2001, while 99365 would represent 31 December 1999.
    how can i write a Java prog which takes an integer parameter in the above form and returns the date as a String in the ddmmyy form?
    can any one pls give me a solution for that?

    A date may be represented in the form : yyddd.
    For example, a date 01035 would represent 4 February,
    2001, while 99365 would represent 31 December 1999.
    how can i write a Java prog which takes an integer
    parameter in the above form and returns the date as a
    String in the ddmmyy form?
    can any one pls give me a solution for that?Check out the SimpleDateFormat Class
    http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    An input format of yyDDD and an output format of ddMMyy seems reasonable
    Good Luck
    Lee

  • Problems with the Pacific/Auckland timezone

    I have a problem with the Pacific/Auckland timezone.
    I have a client in New Zealand using Java on a Windows XP computer with the Auckland, Wellington Windows timezone. Around March 30th he had one hour dis-alignment in the Java time and the Windows time, this went on for some days until after the timezone switched Daylight Saving Time (DST) off April 4th.
    I have tested it with the small program below and will have the problem again from September 27th to October 3th (New Zealand turn DST on September 26th). It seams to be a problem only for the Pacific/Auckland timezone as when I use other timezones the problem does not occur. Is this a bug in Java or do I do something wrong?
    Note: I tested using the JRE 1.6.0_20
    import java.util.GregorianCalendar;
    import java.util.Calendar;
    import java.util.TimeZone;
    public class ShowDate {
         public static void main(String args[]) {
              Calendar cal = new GregorianCalendar();
              String str = cal.toString();
              String data[] = str.split(",");
              for (int i=0; i<data.length; i++) {
                   System.out.println(data);

    The problem was not connected to Java but a missing update of the Windows system

  • Request fix for timezone related bugs

    To Adobe Lightroom employees...
    Even the new release of LR3 still has age old timezone bugs which are likely infuriating for anyone who shoots in more than a single timezone.
    Problem 1: LR ignores camera metadata relating to timezone.
    Solution 1: Include a time/date panel in the importer dialog. If camera metadata is present, use it to set defaults. Provide options for shifting both the time and the timezone (e.g. can shift 2010-01-01T01:05:06+01:00 to become 2010-01-01T01:02:03-02:00). This info can be stored in LR database and in exported XMP data.
    Problem 2: LR exports incorrect timezone data.
    Solution 2: Due to EXIF limitations this cannot be guaranteed correct. Provide an option to export EXIF date/time using a specified timezone (origination/computer/other).
    Other problems: File renaming issues relating to timezones, sorting in grid view, etc.
    Solutions: If every file has an assigned timezone, all these should become moot points, as information is held to get it right.
    The bottom line is that most timezone issue have been present since Lightroom was initially released, and numerous people are frustrated with having purchased a leading product with a glaring set of bugs which corrupt valuable metadata, and interrupt workflow. Providing fixes for these bugs and facilities for handling them sensibly and gracefully, along with default options to provide the current behaviors, allows for the best of both worlds. Date/time are key bits of metadata for any photo, and an inability to handle this properly in one of the leading brands of software is, quite frankly, inexcusable. New features keep being included, yet important basic functionality such as this gets left aside; please prioritize this for the next release to appease many long-suffering, paying customers.
    Stan

    I too wish that Lightroom would handle date/times with time zones and let users manipulate them.  LR 3 consistently ignores time zones; see this post for details:
    http://forums.adobe.com/message/2931846#2931846
    I think the root cause of this mess is that the EXIF standard, defined in 1998, doesn't support time zones (hard to believe that a standards committee would make such a basic mistake).  Even though Adobe's XMP standard requires the use of time zones, LR ignores them!

  • How to pass js variable to be used in managed bean constractor?

    Hi,
    I got a list of items that i present in <h:selectOneMenu on my page (the first page the user sees)
    the labels that are shown in the ><h:selectOneMenu are date + time , and the time itself is stored in the db in UTC without any + or - timezone offset (e.g UTC +2)
    In order to show the correct time in the labels of the ><h:selectOneMenu I'm adding the needed offset of the user timezone
    the problem is that the ><h:selectOneMenu is being populated from the managed bean before I'm passing the offset from the xhtml page itself using jQuery $.post(
    like this
    <h:head>
    <script type="text/javascript">
              jQuery(document).ready(function($) {
                   d = new Date();
                   var tz = -1 * d.getTimezoneOffset()/60;
                   $.post("/servlets/TimeZoneFromClientServlet",{timezone : tz});
           </script>
         </h:head>any ideas how can i pass the TimezoneOffset to the application before the managed bean is loaded?
    Thanks ahead!
    Daniel.

    You know, any website I've encountered so far ASKS for your timezone. Why do you think that is?
    In any case, if you really want to go ahead and do what you want, you need a single point of entry in your web application that sets the timezone in the session once so you can reuse it. It could be something as simple as doing it in a login page if you have one; just create a hidden input field that is prefilled with the timezone you find using Javascript; then simply submit it to the server and stick it in the session there. When the session times out the user would have to login again, which would give you the timezone value back.
    another option: is the managed bean session scoped? If so you can simply fetch it in your servlet and update the appropriate property of the managed bean. This one makes me feel some shame for suggesting it though.

  • Date problem with IST(+5:30) timezone

    Hi,
    I'm having problem with Timezone IST, which is GMT + 05:30.
    SimpleDateFormat returns incorrect date when timezone on client machine is other than IST.
    When Timezone on machine is IST, correct value is returned.
    See the below example. All four dates are same ( LKT is also + 05:30).
    When timezone on machine is IST, all four dates are displayed same.
    For any other timezone, IST date is displayed incorrectly, rest 3 are displayed correctly.
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    public class Test {
        public static void main(String[] args) throws ParseException {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM d HH:mm:ss Z yyyy");
            Date date1 = simpleDateFormat.parse("Wed Sep 02 02:17:41 +0530 2009");
            Date date2 = simpleDateFormat.parse("Wed Sep 02 02:17:41 IST 2009");
            Date date3 = simpleDateFormat.parse("Tue Sep 01 13:47:41 PDT 2009");
            Date date4 = simpleDateFormat.parse("Wed Sep 02 02:17:41 LKT 2009");
            System.out.println(date1.toString());
            System.out.println(date2.toString());
            System.out.println(date3.toString());
            System.out.println(date4.toString());
            System.out.println("Date1 equals Date2? " + date1.equals(date2));
            System.out.println("Date1 equals Date3? " + date1.equals(date3));
            System.out.println("Date1 equals Date4? " + date1.equals(date4));
            System.out.println("Date1.getTime() " + date1.getTime());
            System.out.println("Date2.getTime() " + date2.getTime());
            System.out.println("Date3.getTime() " + date3.getTime());
            System.out.println("Date4.getTime() " + date4.getTime());
    Output when timezone on client is GMT IST (GMT + 05:30):
    Wed Sep 02 02:17:41 IST 2009
    Wed Sep 02 02:17:41 IST 2009
    Wed Sep 02 02:17:41 IST 2009
    Wed Sep 02 02:17:41 IST 2009
    Date1 equals Date2? true
    Date1 equals Date3? true
    Date1 equals Date4? true
    Date1.getTime() 1251838061000
    Date2.getTime() 1251838061000
    Date3.getTime() 1251838061000
    Date4.getTime() 1251838061000
    Output when timezone on client is GMT (Casablanca):
    Tue Sep 01 15:47:41 ACT 2009
    Tue Sep 01 19:17:41 ACT 2009
    Tue Sep 01 15:47:41 ACT 2009
    Tue Sep 01 15:47:41 ACT 2009
    Date1 equals Date2? false
    Date1 equals Date3? true
    Date1 equals Date4? true
    Date1.getTime() 1251838061000
    Date2.getTime() 1251850661000
    Date3.getTime() 1251838061000
    Date4.getTime() 1251838061000
    Output when timezone on client is PDT ( -0800, -0700 for this date due due Daylight saving):
    Tue Sep 01 13:47:41 PDT 2009
    Tue Sep 01 17:17:41 PDT 2009
    Tue Sep 01 13:47:41 PDT 2009
    Tue Sep 01 13:47:41 PDT 2009
    Date1 equals Date2? false
    Date1 equals Date3? true
    Date1 equals Date4? true
    Date1.getTime() 1251838061000
    Date2.getTime() 1251850661000
    Date3.getTime() 1251838061000
    Date4.getTime() 1251838061000
    IS this a bug in java??
    Regards

    Your program is in error. PDT and LKT are not valid time zone ids in Java. There may be other problems, also, I didn't check.
    I know this program produces valid results, you can try it
    import java.text.DateFormat;
    import java.util.Date;
    import java.util.TimeZone;
    public class DateTest
        public static void main(String[] args)
            Date current = new Date();
            DateFormat df =
                DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.FULL);
            System.out.println("Default TZ: " + df.format(current));
            df.setTimeZone(TimeZone.getTimeZone("IST"));
            System.out.println(df.format(current));
            df.setTimeZone(TimeZone.getTimeZone("GMT"));
            System.out.println(df.format(current));
            df.setTimeZone(TimeZone.getTimeZone("Etc/GMT-5"));
            System.out.println(df.format(current));
    }This program lists all of Java's time zones
    import java.util.*;
    public class TimezoneList
        public static void main(String[] args)
            int msPerHr = 3600 * 1000;
            String[] ids = TimeZone.getAvailableIDs();
            for (int n = 0; n < ids.length; n++)
                TimeZone tz = TimeZone.getTimeZone(ids[n]);
                System.out.print(
                    "TZ: " + ids[n] + "  " + (double) tz.getRawOffset() / msPerHr + "  ");
                System.out.println(
                    tz.useDaylightTime() ? "DST=" + (double) tz.getDSTSavings() / msPerHr : "");
    }

  • Calendar, Timestamp, TimeZone and DateFormat

    I need to persist date and time with a time zone information into database. In the application, I use the Calendar to represent the data and converse it to java.sql.Timestamp when I need to store the date into DB, use its reversed process to retrieve the data. The following process works for my need in some degree.
    1. create a Calendar instance
    2. convert it to Timestamp to match the DB field type and save into DB
    3. retrieve the field from DB and convert back to Calendar (from Timestamp)
    4. process the data with DateFormat for a given TimeZone GMT
    My problem with the above approach is that it yields an incorrect data when a date time in DB is already in time zone GMT stored by another system process.
    What is a good approach in the regard?
    Thanks for your information in advance.

    Isn't Timestamp always "in UTC"? If you want to remember a TimeZone, would you need to store that separately?
    Then again, I have this vague recollection there's a database type that combines timestamp and timezone, but does your DBMS have it?

Maybe you are looking for

  • Idoc creation when sales order is saved

    Hi all, I have a requirement of Idoc creation in CRM 7.0 server. Whenever Sales order will be created , upon SAVE , idoc should be created and will be passed to XI server. This  is a scenario of Idoc to XML conversion . I am new to CRM server . Kindl

  • Looking for Active Data Guard in Oracle 11g Release 2 References

    I want to reach out to customers who have implemented Active Data Guard in production (preferably 11.2), so that we can develop some customer references that in turn will benefit other customers. The customers who get selected for such references may

  • Panic 4, memory leak ?

    Hello The past days ever since i installed memory clean ultie from the appstore and did a clean my macbook seems to crash right after i did the memory clean i removed the program from my applications so i dont know wether this is actually the problem

  • Grouping Brushes and Symbols

    Please add the possibility to group brushes and symbols. Thanks.

  • Error at WAD

    Please use an appropriate title - you have mentioned WAD but your post talks about report designer in WAD i am trying to get report designer, i am getting belwo error, please let me know how can i resolve W392    Element REPORT_ITEM_1 requires a mand