DateTime with Timezone in XSLT

All,
version: 11.1.1.4
I have a requirement where in I have to validate the datetime in XSLT. User A will send a xml doc with a dateformat he is comfortable. like this many users will send a similar xml doc to my application which can have datetime in any format. But my application wants in a particular format i.e '2013-01-20T05:11:42+05:30'. In XSLT I want to check if the dateformat in the xml doc is in the expected format, send the doc as it is, otherwise format it to the expected date. I'm exploring xp20:format-dateTime function to achieve this.
to put it in simple algorithm
if dateformatin xml doc = 'format expected' then
send as it is
else
format it to expected date
I tried using the xp20:format-dateTime function as <xsl:value-of select="xp20:format-dateTime(/ns0:cXML/Request/InvoiceDetailRequest/InvoiceDetailRequestHeader/@invoiceDate,'[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01]')"/> but don't know how to add the timezone to it. Any help is appreciated.
thanks
sen

many users will send a similar xml doc to my application which can have datetime in any formatJust be aware that receiving datetime in any format as you stated is not quite achievable... If you receive 01-12-2013, will be that the 12th of Jan or the 1st of Dec? At the end of the day you will have to decide what format (or formats) you will accept...
Also xp20:format-dateTime won't help you in this matter, this functions gets a ISO8601 date and formats it... I believe you're trying to do the reverse, and there's no function available in BPEL to do it... Either you'll have to write a custom function or use a java callout with SimpleDateFormat...
Cheers,
Vlad

Similar Messages

  • Regarding timestamp with timezone

    Hi,
    I have the following timestamp with timezone issue.
    From java program I am passing the datetime with timezone value to database (INTERVALTIME (column name)).
    PrepareStatemenet statement;
    java.util.Date dt = ISODateUtil.parse("2006-06-21T18:00:00+00:00");
    SimpleTimeZone zone = new SimpleTimeZone(0,"IST");
    Calendar cal = converting the dt to calendar;
    cal.setTimeZone(zone);
    statement.setTimestamp(col, new Timestamp(cal.getTimeInMillis()),cal);     
    In database INTERVALTIME (column name) coulmn type is TiMESTAMP WITH TIMEZONE.Database is in PDT (GMT-8) timezone.
    Now the problem is :
    Even if i send the datetime of IST timezone, it is displaying in PDT (GMT-8) timezone.
    How can i resolve this issue?

    Reo wrote:
    The query you provided doesn't run. If I want to convert to a different timezone, I need the from_tz.Is column update_time a TIMESTAMP WITH TIME ZONE? If so, then no casting is needed:
    SQL> create table test(id number,update_time timestamp with time zone)
      2  /
    Table created.
    SQL> insert into test values(1,systimestamp)
      2  /
    1 row created.
    SQL> insert into test values(2,systimestamp  at time zone 'UTC')
      2  /
    1 row created.
    SQL> select  id,
      2          update_time,
      3          update_time at time zone 'US/Pacific'
      4    from test
      5  /
            ID
    UPDATE_TIME
    UPDATE_TIMEATTIMEZONE'US/PACIFIC'
             1
    18-NOV-09 04.23.03.241000 PM -05:00
    18-NOV-09 01.23.03.241000 PM US/PACIFIC
             2
    18-NOV-09 09.23.29.346000 PM UTC
    18-NOV-09 01.23.29.346000 PM US/PACIFIC
            ID
    UPDATE_TIME
    UPDATE_TIMEATTIMEZONE'US/PACIFIC'
    SQL> SY.

  • How to show Date and Time with TimeZone

    Dear All,
    I have to show Date and Time with TimeZone abbreviation,
    for example:
    1) 31 March 2011 2:30 in india standard time - it should show in screen 31 March 2011 2:30 IST.
    2) 31 March 2011 2:30 in Australia/New Zealand - Eastern time zone it should show in screen 31 March 2011 2:30 AEST.
    how can i show *Australia/New Zealand - Eastern time zone to AEST*,
    I tried with format DD MMM YYYY HH:MM zzz, and i looked time zone API too.
    Appreciate your help
    Thanks
    Daya

    Dayananda wrote:
    ok, than i have to use zzzz format, as z won't help in my case, so i have to use zzzz which display descriptive value like, Indian Standard Time i.e. ISTPer the javadocs there is a very specific reason why that is a problem especially if you intend to support many timezones in one application.
    "+For compatibility with JDK 1.1.x, some other three-letter time zone IDs (such as "PST", "CTT", "AST") are also supported. However, their use is deprecated because the same abbreviation is often used for multiple time zones (for example, "CST" could be U.S. "Central Standard Time" and "China Standard Time"), and the Java platform can then only recognize one of them+."
    Thus you have one single case where there can be many and moreover it can change (twice a year I believe.)
    There is a standard source for this information although when I tried it it appears to not work.
    If the app only needs to display one zone then provide a configuration value that allows a user to overload the display value.
    If the app needs to display many values then you MUST inform business users of the problem because there are duplicates and they, not you, need to decide specifically what happens in those cases.

  • Oracle ODBC driver and TIMESTAMP with timezone

    Does anyone know if it is possible to return data from a "TIMESTAMP WITH TIMEZONE" column using the Oracle ODBC driver and an ADO Recordset?
    I am using the Oracle driver version 10.2.0.2 and TIMESTAMP fields work fine.
    I can call Recordset->Open() with a query like "SELECT * FROM TABLE" when the table contains a column of type timestamp with timezone but when I execute a statement to see if there are results as in
    if (!(srcRecsetPtr->BOF && srcRecsetPtr->EndOfFile))
    my application throws an unhandled exception and exits. The exception is not a COM exception and I'm not sure how to get back additional information if that's possible.
    The only information I've been able to find in searching TechNet and MetaLink is that a workaround is to wrap the columns in a TO_CHAR or TO_DATE conversion first but that's not a good solution for my problem since I am executing user specified SQL which may join multiple tables.
    I've found one other note that says the documentation should be corrected and that these fields are NOT supported period (Bug #4011640).
    I've experimented with the Bind Timestamp as Date option in the ODBC connection and with various ALTER SESSION settings to attempt to change the NLS_TIMESTAMP_TZ_FORMAT but I have been unable to get past the problem.
    Any ideas are greatly appreciated.
    Thanks,
    Troy

    Hi Justin
    Thanks for your help.
    I tried what you mentioned and I could connect myself via SQL*Plus without passing a password and a login, Extern authentification seems to work and my user seems to be right configurated.
    But he problem goes on via ODBC. When I test connection in the ODBC Data Source Administrator of Windows XP, test fails and seems to forbid connection without userID and password. When I try to connect via ODBC in my program the same problem appears : "Unable to connect SQLSTATE=28000 [Oracle][ODBC][ORA]Ora-01017: Invalid username/password;logon denied" I could not connect in this way.. What's wrong ?

  • Converting timestamp with timezone to milisecs

    Hi guys,
    How to converting timestamp with timezone to milisecs?
    I'm using oracle 10g.

    SeánMacGC wrote:
    Hello, do you mean:
    SQL> select to_char(systimestamp, 'SSSSS') from dual;
    TO_CH
    58435
    'SSSSS' Format Model returns 'Seconds past midnight' not milliseconds. I wonder if OP meant Fractional Seconds?
    SQL> SELECT TO_TIMESTAMP_TZ('1999-12-01 11:00:00.00532 -8:00',
      2         'YYYY-MM-DD HH:MI:SS.FF TZH:TZM') col_1 FROM DUAL
      3  /
    COL_1
    01-DEC-99 11.00.00.005320000 AM -08:00
    SQL> SELECT TO_CHAR(col_1, 'FF') fractional_sec FROM
      2  (SELECT TO_TIMESTAMP_TZ('1999-12-01 11:00:00.00532 -8:00',
      3         'YYYY-MM-DD HH:MI:SS.FF TZH:TZM') col_1 FROM DUAL)
      4  /
    FRACTIONA
    005320000
    SQL>Regards,
    Jo
    Edited by: Joice John : Added Code Tags

  • Compare Date with Timezone

    Hi,
    I have a Date which is stored in the Database with the timezone like GMT, I have a java.util.Date which is selected in my UI from a Customized Calendar, I am converting this Date with timezone and want to compare this date with the date with timezone stored in the DB? How to accomplish this, please shed some light into this?
    Thanks.

    797836 wrote:
    I have a Date which is stored in the Database with the timezone like GMT, I have a java.util.Date which is selected in my UI from a Customized Calendar, I am converting this Date with timezone and want to compare this date with the date with timezone stored in the DB?As Parul said, Date does not involve a timezone. I think you need to clarify what you mean by "I am converting this Date with timezone", because it doesn't make much sense to me.
    BTW: If the date in your database is a standard SQL Date, then it will be converted to a java.sql.Date when you read it into Java with JDBC. And java.sql.Date is directly comparable with java.util.Date (in fact, it's a subclass).
    Winston

  • Oracle timestamp with timezone

    Does CR support column of type "timestamp with timezone" column. I am getting error message "Failed to retrive data from database. Details:Not implemented". Thanks

    Since this is the Crystal Reports Java forum, you need to specify the explicit Java java.sql Type that the Oracle JDBC driver exposes the database type as.
    I'm not familiar with that data type, so don't know if it's mapped to the Timestamp type or not.
    Note that CR4E 2.0 supports up to JDBC 4.0 types.
    Sincerely,
    Ted Ueda

  • Why have I lost the info of  timezone (Timestamps with Timezone )

    I have been trying to get timestamps with timezones working in my Java application, but I don't seem to get the data I expect back from the JDBC driver
    my field type is Timestamps with Timezone ,in the database,I saw the info of (12-DEC-06 01.12.12.123000 PM -06:00),but I don't know How to get it from Java
    I've use the Timestamp aa =rs.getTimestamp("FIELDVALUE");but the timezone is lost, what can I do?
    thanks

    Timestamps are always GMT based (or could be thought of as timezone neutral) so what you should get back is a timestamp representing a GMT equivalent of the time you see that has a 6 hour offset from GMT. In other words, if the time were 1 PM Central Standard you would get a GMT time of 7 PM.
    You should then be able to display that time in any time zone you wish using SimpleDateFormat and specifying the time zone you want to display it in. So if you then display it with Central Standard, the 7 PM GMT would then display as 1 PM again. In other words, 7 PM GMT and 1 PM Central Standard are the same timestamp
    If you just display the timestamp using a toString(), you will get the time in the default time zone of the JVM..
    Whether the driver actually does this correctly with the Oracle database I can't say. I've made several posts in a variety of places complaining that the driver does not work correctly with timestamps but my experience is limited to regular timestamp fields, not the new Oracle type of timestamp with timezone.
    Based on my experience, what you are more likely getting back in the 1 PM- 7 PM example is 7 PM in the default timezone of the JVM.
    You should look at the getTimestamp with Calendar options to see if they work better for you.
    The main thing to keep in mind is that timestamps are really timezone neutral.

  • Compare 2 'timestamp with timezone' columns

    Hi All,
    I'm trying to compare 2 'timestamp with timezone' columns,
    comparision works fine as long as there is difference of at least seconds between them.
    But when the difference between them is in milliseconds, comparison is failing.
    I'm using oracle 10g.
    Pls advice.

    Works just fine:
    SQL> DECLARE
      2      t1 TIMESTAMP WITH TIME ZONE := TIMESTAMP '2008-01-10 10:25:17.123456 US/EASTERN';
      3      t2 TIMESTAMP WITH TIME ZONE := TIMESTAMP '2008-01-10 10:25:17.323456 US/EASTERN';
      4  BEGIN
      5      IF t1 <= t2
      6        THEN
      7          DBMS_OUTPUT.PUT_LINE('t1 <= t2');
      8      END IF;
      9  END;
    10  /
    t1 <= t2
    PL/SQL procedure successfully completed.
    SQL> DECLARE
      2      t1 TIMESTAMP WITH TIME ZONE := TIMESTAMP '2008-01-10 10:25:16.123456 US/EASTERN';
      3      t2 TIMESTAMP WITH TIME ZONE := TIMESTAMP '2008-01-10 10:25:17.323456 US/EASTERN';
      4  BEGIN
      5      IF t1 <= t2
      6        THEN
      7          DBMS_OUTPUT.PUT_LINE('t1 <= t2');
      8      END IF;
      9  END;
    10  /
    t1 <= t2
    PL/SQL procedure successfully completed.
    SQL> Based on your:
    But when the difference between them is in milliseconds, comparison is failing. Most likely your code does implicit/explicit timestamp conversion to date. Post your code.
    SY.

  • Client side paging with jstl or xslt

    Is there any way to provide client side paging with jstl or xslt/xpath. I have a jsp page with a limited amount of data, say less than 30 rows of data. I want to display 10 rows at a time. The data is returned to the page in xml format and I am currently using xslt to display the data (currently displays all rows on the page). I am looking for a way to update my xpath variables so I can provide paging capabilities. Is there any way to get the information from the request from the jsp to the xpath variables? Or does anyone have any other suggestions for implementing client side paging using either xslst - xpath or jstl? Thanks Vic.

    I am loading the entire xml stream in the client and formatting using xslt. I only want to initially display 10 rows. I would like to implement client side paging. Is there any way to communicate with the xpath variables? Javascript?

  • XML dateTime type with timezone info.

    Has anyone have problem FTPing xml that conforms to a xml schema with dateTime type?
    This is the format of standard XML dateTime type:
    "2003-12-17T09:30:47-05:00"
    I used the Oracle timestamp datatype, but oracle rejected the dateTime of XML with the error message
    "ORA-01830: date format picture ends before converting entire input string."
    I have altered the database to use timezone information:
    // For eastern time zone.
    alter DATABASE SET time_zone = 'Etc/GMT-5';
    and use the native oracle datatype
    "TIMESTAMP WITH TIME ZONE"
    but still doesn't work. I also changed the XML time data to "2003-12-17 09:30:47-05:00", still no good.

    I tried couple formats, they all seem to need the "T" in between date and time. If I don't have the "T", I get the error message "ORA-01861: literal does not match format string"
    If I use the following input I get the error message
    "ORA-31041: Property CreateDate: Memory type (180) not compatible with database type (121)"
    "2003-12-11T21:30:47.0"
    "2003-12-11T21:30:47.000000"
    "2003-12-11T21:30:47.000000000"
    "2003-12-11T21:30:47000000"
    "2003-12-11T21:30:470000"
    If I use the following I get error message "ORA-01830: date format picture ends before converting entire input string"
    "2003-12-11T21:30:470000-04:00"
    "2003-12-11T21:30:47.000000-05:00"
    "2003-12-11T21:30:47.0-05:00"
    It leads me to think that "2003-12-11T21:30:47.000000"
    is the picture(mask) used by the database. But it has extra "T" in it, and oracle doesn't understand the datatype. Maybe there are two validation going on? one from schema and another during insertion to database? Schema requires "T", but database doesn't understand "T"?
    Am I in the right track?
    Do you know how do I query the mask used?
    Thanks,
    --Benjamin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Compare two dateTime with different timezone

    HI, All,
    I found a strange thing when compare two dateTime in BPEL;
    In my BPEL process, client passed a date time to the process , and the process compare the date time with current data time.
    1.client pass cutoffDate to process
    2. in a switch activity, I compare cutoffDate with current date. code:
    bpws:getVariableData('cutoffDate')<=xpath20:add-dayTimeDuration-to-dateTime()
    but seems this compare ignored the timezone information.
    For example:
    cutoffDate=2010-03-05T06:17:38.838+00:00
    currentDate=2010-03-05T14:10:38.838+08:00 this time =2010-03-05T06:10:38.838+00:00
    but cutoffDate<currentDate == true... seems it ignored the timezone info..
    This is a bug or I used a wrong compare function?
    Thanks.
    Edited by: Colin Song on Mar 5, 2010 3:28 PM

    Hi Colin,
    Please go through below link, there is topic about calculating difference between dates. Hope you find solution.
    http://blogs.oracle.com/reynolds/2007/07/19/
    Please let me know, if still not successful.
    Thx,

  • Php input date/time as timestamp with timezone

    This is a nightmare!!!!
    I have numerous databases, all of which use timestamp format
    date/times, which are easy to echo according to user timezone
    preferences using putenv ("TZ=".$_SESSION['MM_UTZ']); and echo
    date($_SESSION['MM_UTF'], ($whatever));
    The only problem is, I have only used these for stamping
    "date created" or "date edited" values using Time()
    What I am trying to achieve is:
    User 1 in UK enters date and time, using a javascript
    datetime picker (which normally enters data into field in Y-m-d
    H:i:s) and the php inserts this in timestamp format according to
    timezone.
    User 2 in US looks at date and time and this is echo'd
    according to his timezone.
    Sounds simple...
    I have managed to get so far with the new DateTime object
    which incorporates the user timezone preference ($utz)
    $ndttime= new DateTime($timefield, new DateTimeZone($utz));
    I can then echo this effectively using
    echo $ndttime->format('$utf'); ($utf being user timeformat
    preference)
    My stupid problem is trying to get the $ndtime into the
    database!!!!
    I know this sounds ridiculous but I use the DW insert wizard
    which only uses values from a form and if I echo $ndtime into a
    hidden field, it doesn't process this value in time.
    I attach the current insert script.
    Is this simple?
    Heeeeelp.

    quote:
    Originally posted by:
    AXEmonster
    how does this format when you echo to the page
    echo $ndttime->format('$utf');
    This will echo as a date/time object - i.e. Y-m-d H:i:s, but
    the $utf variable is a session variable with user time format
    preferences, so it could be D, d/m/Y H:i:s or m-d-Y H:i:s
    etc.

  • More trouble with timezones when storing value in TS WITH LTZ

    Using Oracle 9i, JDK 1.4.2.
    I have a script using the Jakarta Jelly framework to initialize my db. When I run the script, I want to set the current time in several "TIMESTAMP WITH LOCAL TIME ZONE" columns.
    Before the time change, the following excerpt from my script was working fine.
    <j:new className="java.util.Date" var="now" />
    <j:new className="java.text.SimpleDateFormat" var="format">
    <j:arg type="java.lang.String" value="dd-MMM-yyyy hh.mm.ss.SS a Z"/>
    </j:new>
    <j:set var="ts"
    value="cast(cast('${format.format(now)}' as timestamp with time zone) as timestamp with local time zone)"/>
    The "Z" in the date/time format produces a 3-letter timezone abbreviation, like "PST" or "PDT".
    Before the time change, I was getting "PST" from this, and the code was working fine. When the time change hit, I discovered that Oracle doesn't grok "PDT" (I found info on the internet about this, but I can't find it right now). I thought for a short time on this, and I changed "Z" to "z", which results in "-0700" instead of "PDT". This appeared to work fine. It didn't fail, at least.
    However, what I discovered today is that Oracle gets confused by it. It recognizes that as a timezone offset, but it only "half" understands this. When I view the value in SQLDeveloper, it shows a time value 7 hours before the current time, instead of the correct current time as it used to.
    I also tried hardcoding a date string, using "US/Pacific", and Oracle groks that, but of course, it doesn't know to use daylight savings time.

    that makes sense because you are setting the sessionAttribute at the wrong time.. see you are passing the paramater from index to shop, so you really need to set the sessionAttribute in the index page so it is always available in the shop page.
    hope that helps...you will always have this problem when refreshing because when you refresh the value from "customer" is not being passed again.....

  • Stand alone APEX listener install fails with timezone region  not found

    Hi,
    I have searched the forum but found only a thread for the installation with Goldfish.
    I am very new to all this so I apologise if my problem is too simple, but please help as I am very frustrated with it.
    I have a 10.2.0.4 database on Windows XP for testing with.
    I installed APEX into it successfully, then down loaded the listener.
    I have to Java installations, one under my Oracle Home, the other under Middleware where I have JDeveloper installed.
    If I try $ORACLE_HOME/jdk/bin/java -jar apex.war it throws a Unsupported class version so I tried with the Middleware jdk and it appeared to install.
    I then went to http://localhost:8080/apex/listenerConfigure and entered the password for APEX_PUBLIC_USER and the info for a basic connection, it fails with the following message
    Request could not be processed due to error:
    Sat Apr 30 00:06:30 CAT 2011
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01882: timezone region not found
    Please if anyone can help me through asap this I would be most grateful

    Yay, I found the solution:
    I started by running:
    begin
    for v_rec in (select tzname,tz_offset(tzname) v_offset from v$timezone_names
    where tzabbrev='CAT') loop
    dbms_output.put_line('tzname '||v_rec.tzname||', offset '|| v_rec.v_offset);
    end loop;
    end;
    SQL> /
    tzname Africa/Khartoum, offset +03:00
    tzname Africa/Windhoek, offset +01:00
    tzname America/Anchorage, offset -08:00
    tzname US/Alaska, offset -08:00
    PL/SQL procedure successfully completed.
    I then added -Duser.timezone="+01:00" before the apex.war ie
    java –jar -Duser.timezone="+01:00" apex.war

Maybe you are looking for

  • Can't bring up videos tab on my 3rd gen iPod touch

    As of late I haven't been able to bring up my videos using the button on the bottom of the touch screen. I can still watch music videos if use the search function or go through the music tab. When I press the video button the screen turns white for a

  • DataTable with dynamic columns

    Does somebody have an example of how to code a h:dataTable with dynamic columns? I have seen hints about how to do it in these two articles: http://forum.java.sun.com/thread.jspa?forumID=427&threadID=5218508 http://forum.java.sun.com/thread.jspa?thre

  • How to handle restocking fee

    Dear guru, We cut a PO to vendor and later we decided to cancel the PO.  However the vendor wants to charge a 15% cancellation fee(or restocking fee).  I need your opinion on how to handle this situation: 1. if this is a stocked/valuated material, ca

  • English language of FMw 11gR2

    Hello Is it possibile when Installing FMw 11gR2 (setup.exe) can I get English language of Builder? In setup.exe -help I don't see var Lang, I have 2 PC one with SO in english and it's ok, the other is Italian(I don'understand it) and I want english,

  • Problem with ACS 4.1 using certificate

    I have an ACS 4.1 appliance, I have already configured ACS in order to work with certificate. I got the certificate from ACS, I already installed it as the installation guide says . Additionally I configured the card's controller in my PC in order to