Format of the string when rs.getString(

I want to retrieve TIMESTAMP WITH TIME ZONE field from Oracle using JDBC..
I have to retrieve it as String (using rs.getString not rs.getDate) so that I can have the Time Zone information, otherwise I lose tz..
String sql = "SELECT field1 , to_char(field1) FROM table";
rs.getString(1) returns string : "2004-8-8 9.0.0.123457000 US/Eastern"
rs.getString(2) returns string formatted according to the property NLS_TIMESTAMP_TZ_FORMAT in Oracle.. in this case i retrieve "08/08/2004 09:00:00 -04:00" when my NLS_TIMESTAMP_TZ_FORMAT is MM/DD/YYYY HH24:MI:SS TZH:TZM
I have no control over the SQL string so I can't use "to_char( ..)" in SQL.. so I have to retrieve the date using rs.getString(1)...
Where is the FORMAT of the string returned by rs.getString(1) defined?
Can it be manipulated? If not is it guranateed that it will always come in this format?
I would appreciate any information regarding the format of the string returned when I retrieve date using rs.getString instead of rs.getDate...
Thanks

Presumably you understand that the timezone will bethat of the database and >will have nothing at all to
do with where the time was entered.
So why do you want the timezone of the database?TIMESTAMP WITH TIME ZONE is a data type in Oracle
which holds timestamp and timezone in one field
altogether... it has nothing to do with timezone of
the database...I see.
Then other databases do not matter because other databases do not do this.
And as I suggested you should use to_char() to return the format you want. You should also be prepared to do something with that timezone in your own application, since presumably there is a business reason for that field. And the Java API is not going to deal with that.
>
>
You can format you strings to use to_char() andspecify the format you want
I have no control over the SQL string... I my program
I will just get the ResultSet of some sql that
retrieves the Timestamp With Time Zone field in
Oracle..
so I cant use to_char (...) ... For that reason I
have to receive it as String...
To be able to process that string I need to know if
there is a set format for date when one retreves it
by getString(....)As I already said, there is no set format.
Given that someone is giving you the SQL then I suggest you also require that they give you the timestamp format.

Similar Messages

  • Making a textfield do something with the string when enter is pushed

    I want this textfield to be able to do something when I hit the enter how is this done, is there a method in the textfield that can so this or will I have to set up a keylistener?

    If you want done something after the validation. Use the addActionListener method.
    JHelp

  • Change the format of a string

    Hello all,
    Now what shall I do is to convert a string to an array.
    The string I got is shown in the pic in attachment, together with my code.
    Obviously the array isn't correct.
    i wonder if there's a way to change the format of the string without the empty lines, and concatenate each number after another,
    in order to have a correct array with my code.
    Or someone has idea to make a new code for converting a string like this to array?
    Thanks
    Chao
    Solved!
    Go to Solution.
    Attachments:
    Immagine1.PNG ‏63 KB

    Hi Gerd!
    Here is my VI. Actually I figured out a simple way to implement this, just by
    adding a Trimwhitespace.vi between the input string and match pattern, and that works!
    I'm still glad to know how do you use spreadsheetstringtoarray.
    Thanks in advance if you can show me that!
    Chao
    Attachments:
    decompose_VI.vi ‏20 KB

  • NewLine Character in the String received from Interactive Adobe Form

    Hello Experts,
    Following is the issue we have with interactive Adobe Form
    We have a text area within the form. User enters the text in multiple lines in this text area.
    We are calling a backend function module designed in SE37 that accepts and process the data from the adobe form.  We are also processing the string data user enters in the text area.
    When we receive the string from the form, the newline character within the string is displayed as '#' in the debugger. We tried splitting this string using cl_abap_char_utilities=>newline and cl_abap_char_utilities=>cr_lf  but NO luck. Though in the debugger we see cl_abap_char_utilities=>newline  as '#'  in the debugger and also '#' is present within the string, for some reason when string is processed to find cl_abap_char_utilities=>newline, we can find/locate it.
    Because ABAP code is not able to identify the newline character within the string received from Adobe form, we are not able to maintain the formatting of the string as it was entered in the form.
    Any help to resolve this issue is appreciated.
    Thanks in Advance.
    Regards,
    Bhushan

    Hi Bhushan,
    I was going through your issue, and I feel this is something you can do with scripting. Basically you should read whole string and find the new line character and replace with a space or comma, as per your requirment.
    Do like following:
    In the exit event of the field select java script and write following code:
    var strng = this.rawValue;
    strng.replace(/\n/g, " ");
    above im reaplcing new line with a space.
    I think it should work I have not tested it. Pls update if you test it .
    Regards,
    Ravi.D

  • Please Help!! How to get the width of the String for print out?

    Hi there,
    I need to do some printing in my application. I just want to know how can I get the width of the string when it is printed on the paper.
    I have tried to use the following code to get the width
    Rectangle2D rec = font.getStringBounds(str, new FontRenderContext(null, true, true));
    double width = rec.getWidth();
    however, the width I got from that function is not correct (the returned width is longer than the printed one)
    Does anyone know how to solve this problem?
    Thank you and Happy New Year !

    hi,
    The getFontMetrics(Font) is also defined in the Component class and therefore you can retrieve it even if you dont override the paint method.
    try the following (provided ur code extends some class that extends Component indirectly)
    FontMetrics f = this.getFontMetrics(this.getFont());
    int width = f.stringWidth(str); //str is the String for which u need to check the width.
    hope this was useful
    happy holidayz

  • Incompatible format all the sudden

    I am getting "incompatible format" all the sudden when trying to import into Studio Pro. I have tried many different compressions using compressor 3 but I getting the same result. Any help would be greatly appreciated.
    Thanks!

    Hi
    Probably you are trying to import HD assets in SD projects or vice versa.
    Hope that helps !
      Alberto

  • Convert the date of string to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.

    I need convert the date of string format 'MM/dd/yyyy' to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.Since
    I need to search values based on date where my database datetime  is 'MM/dd/yyyy' format.

    In my opinion you should re-consider the assumption that the date picker returns a string. Maybe it is able to return a
    DateTime object directly instead of string. Then you will pass this value as a parameter of SQL query. This should work regardless of computer configuration.
    Otherwise, follow the previous string-based approaches.

  • Format of the initialization string does not conform to specification starting at index 97 while uploading .xlsx file

    Format of the initialization string does not conform to specification starting at index 97.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 97.
    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Hello,
    The Windows Desktop Perfmon and Diagnostic tools forum is to discuss performance monitor (perfmon), resource monitor (resmon), and task manager, focusing on HOW-TO, Errors/Problems, and usage scenarios.
    Since your post is off-topic, I am moving it to the
    off topic forum.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • What is the correct format of filepath string on Mac os x?

    I am trying to retrieve a file from Mac os x by:
    File file=new File(filepath);
    My boot volume name is "myVol", and filepath is "/myVol/opt/ab.txt". However, when I provide this path, the file is not found. I just figured out that if I use "/opt/ab.txt" the correct file can be found!!
    Now, if I have a shared volume on my machine(I got it by menu "Go-->Connect to Server..."), whose name is "Mac Share", the filepath should be something "/Mac Share/test/123.txt". File file=new File("/Mac Share/test/123.txt") can not find the file. It looks like that it's trying to find 123.txt from /myVol/Mac Share/test directory, which doesn't exist. I even tried "//MacShare/test/123.txt", "Mac Share/test/123.txt", etc., and none of them worked!!
    If you know the correct format to specify the filepath on Mac OS x, please give me help!!!!
    Thanks in advance.

    I don't know the exact answer to your question, but you can probably figure it out on your own like:
    1) Create a File object that represents an existing file. Play around with the path until the file can be found.
    2) Now that you have a File object representing a valid, existing path, use MyFile.getAbsolutePath() to see what the full path string is. MyFile.getCanonicalPath() might provide some answers as well.
    Whatever getAbsolutePath() returns is the correct format for the file path string.

  • I have Video camera movies that are HD format.. I am doing editing work on them using Final Cut Pro, but using DV PAL format for the projects I am editing. When I then tried to copy my work done in FCP Project that's originally DV PAL , into a new FCP Pro

    I have Video camera movies that are HD format.. I am doing editing work on them using Final Cut Pro, but using DV PAL format for the projects I am editing. When I then tried to copy my work done in FCP Project that's originally DV PAL , into a new FCP Project that is HD, and tried reconnect media with original HD movies (video), the sequence project got distorted for all the text, shapes used and all.. everything changed its orientation and scale.. Is there a way by which I can preserve my work done on DV PAL and switch it preserving its proportions, scale and orientation, but on a HD project sequence?? Appreciate your help and advice..

    Yes.  A couple of ways that might work.
    First Way
    What you need to do is load one of your hd clips in the viewer and edit into a new HD sequence.  Does it display correctionly? 
    OK, select the clip in the hd timeline and copy (command-c).  Now go to the HD sequence with the material that's distorted.  Select all (command-a) and paste attributes (option-v) and choose basic motion and distort.  That should maek things work.  What won't work is anything that you've adjusted as far as basic motion or distort in your PAL sequence.  That I'm pretty sure you'll have to redo.
    Second Way. 
    Choose your original PAL sequence and do a Media Manage changing the sequence preset to the appropriate HD paramenters with the media offline.  You then should be able to reconnect these clips with your original HD media.

  • Since installing the last iPhoto update sharing a photo via e-mail opens a google e-mail format instead of an Apple Mail format.  How can I get the Apple Mail format to come up when I click on share?

    Since installing the last iPhoto update sharing a photo via e-mail opens a google e-mail format instead of an Apple Mail format.  How can I get the Apple Mail format to come up when I click on share?

    iPhoto preferences - set the email client to Mail
    LN

  • How to add date in MM/DD/YYY  format at the end of a string

    Hi
    I want Description to look like
    ' PARTICIPATION ON TEMPORARY TV SHOW EXPIRING ' and include the "latest show expiration date" as "MM/DD/YYYY"
    Pls help ......
    try {
                            Date date= new Date();
                             System.out.println("THE TODAYS DATE is :"+date);
                               DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    //                         DateFormat df = new SimpleDateFormat("MM/DD/YYYY");   -----> Its not allowing this format ????????
                             begin_Date = hashDateE.get(id);
                             System.out.println("THE LATEST TV SHOW DATE is :"+begin_Date);
                             Date d1 = df.parse(begin_Date);
                             String relation;
                             if(d1.equals(date))
                                  relation = "both the dates are same";
                             else if(d1.before(date))
                                  relation = "BEFORE";
                             else
                                  relation = "AFTER";
                             //System.out.println(d1 + "is" + relation + ' ' + date);
                             if("10".equals(latestShow)){
                              if("BEFORE".equals(relation)){
                                   System.out.println("The latest show date is expired");
                              Code =3;
                              Description = "PARTICIPATION ON TEMPORARY TV SHOW EXPIRED ";
                              else if("AFTER".equals(relation)) {
                                   System.out.println("The latest show date is non expired");
                                  Code = 2;
                                   Description = "PARTICIPATION ON TEMPORARY TV SHOW EXPIRING" + d1; -------------> I TRIED THIS WAY ( d1 should be in this format MM/DD/YYY
                              }else {
                                   System.out.println("The latest show date is non expired");
                                 Code = 20;
                                  Description = "PARTICIPATION ON TEMPORARY TV SHOW EXPIRING" + d1;
                        

    If you have a string like 2008-12-15 and you want to interpret it as a date and format it as 12/15/2008, then you need two DateFormat objects.
    One to parse the String in the first format into a Date, -------> i could do this
    try {
              String begin_date = "2008-12-15";
              System.out.println("The begin date is :"+begin_date);
              DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
              Date d1 =  df.parse(begin_date);
              System.out.println("the Date value is d1 :"+d1);
    catch() {
    }Output is :The begin date is :2008-12-15
    the Date value is d1 :Mon Dec 15 00:00:00 EST 2008
    Pls help me with the second part :- ?????/
    and one to format that Date into a String in the second format. MM/dd/yyyy --- how to do this ..after i tried several times with different statements , i am asking this piece of code to achieve this

  • When I try to import pictures from media card to iPhoto, I'm getting the error 'The following file could not be imported. The file is in an unrecognized format.'  The file is a jpeg and I've never had this problem before.

    When I try to import pictures from media card to iPhoto, I'm getting the error 'The following file could not be imported. The file is in an unrecognized format.'  The file is a jpeg and I've never had this problem before.

    What version of iPhoto?
    What colour profile is the shot?
    As a Test:
    Hold down the option (or alt) key and launch iPhoto. From the resulting menu select 'Create Library'
    Import a few pics into this new, blank library. Is the Problem repeated there?

  • I am shooting with a Nikon D60 on Fine Format and unable to print larger than 11x14.  I have been able to print larger pictures.  I am told iPhoto reduces the size of the file when uploaded. Is this true? If so how can I change this?  I need 16x20's

    I am shooting with a Nikon D60 on Fine Format and unable to print larger than 11x14.  I have been able to print larger pictures.  I am told iPhoto reduces the size of the file when uploaded. Is this true? If so how can I change this?  I need 16x20's

    I am shooting with a Nikon D60 on Fine Format and unable to print larger than 11x14.  I have been able to print larger pictures.  I am told iPhoto reduces the size of the file when uploaded. Is this true? If so how can I change this?  I need 16x20's

  • I just set up a new computer running Windows 8.1. When I go to my icloud photostream, the pictures are in PNG format NOT JPG. When I open and upload photos from the photostream, the resolution is so low that the image quality is terrible. Help?!?

    I just set up a new computer running Windows 8.1. When I go to my icloud photostream, the pictures are in PNG format NOT JPG. When I open and upload photos from the photostream, the resolution is so low that the image quality is terrible. Help?!?

    Hey Sierra, You can do just what you have stated. My question, what is your "other"? If it is over 1.5 GB you most likely have corrupt files. Doing a Restore to New, Factory restore should correct it. Just make sure you make a full backup of all information on your iPod to your computer before you restore, so you don't lose your stuff, contacts, videos, pictures, non-iTunes music, etc, use the cable and connect with your computer. Then, via cable, connect to your computer, run the Restore to new, don't use your backup. Treat this iPod as if it was your first one ever. When restore is done, set up and add what info you wish to install on this iPod. The music apps etc you purchased should be on your computer, if not you should be able to retrieve purchased apps and music from iTunes. Any music, videos, apps not purchased from iTunes will be lost to you if you do not save them to your computer or the cloud first. When your done, make a current Backup and you should good to go. Hope this helps. Good luck. Cheers.

Maybe you are looking for