Does Simple Date Format suppourts This convrsion??

Hi ,
I am getting this Date as String
String str = "Fri May 13 2011 19:59:09 GMT 0530 (India Standard Time)";
How to convert this Date Object into yyyy-mm-dd HH24:Mi:ss Format ??
I have not seen any example using SimpleDateFormat with this format ??
Please can anybody please show me how to do this ??

user10503747 wrote:
Hi ,
I am getting this Date as String
String str = "Fri May 13 2011 19:59:09 GMT 0530 (India Standard Time)";
How to convert this Date Object into yyyy-mm-dd HH24:Mi:ss Format ??
I have not seen any example using SimpleDateFormat with this format ??
Please can anybody please show me how to do this ??The following works for me.
String str = "Fri May 13 2011 19:59:09 GMT 0530 (India Standard Time)";
str = str.replace("GMT ", "GMT +");
SimpleDateFormat sf = new SimpleDateFormat("EEE MMMMMMMMMMM d yyyy H:m:s 'GMT' Z");Although not relevant to your actual problem the above will not work if '-' is used instead of the '+'. No idea why that is. It parses but seems to ignore the offset in that case.

Similar Messages

  • Why cant I have the date format like this:  1/2/07, it converts to Jan 2

    Why cant I have the date format like this: 1/2/07, it converts to Jan 2, 2007
    I want to keep it like that because, I transported a huge spreadsheet from my PC, and it has like this: 1/1/07, and there is way to many, to go back and change. Please help. Thank you.

    Hello
    Welcome to the club.
    The response seems to be simple.
    Those who wrote the Help are not those who wrote the PDF User's Guide which are not those who coded the application.
    As on this forum you will met only users trying to help other users, no one would be able to tell you if what we got is a bug or a design flaw.
    Like many of us,
    *Go to "Provide Numbers Feedback" in the "Numbers" menu*, describe what you wish: a way to define the default format used as Automatic date/time.
    Then, cross your fingers, and wait for iWork'09
    Yvan KOENIG (from FRANCE mardi 15 janvier 2008 15:10:17)

  • Regarding simple date format

    Hi,
    Can any one please tell what is simple date format for below format.
    2008-11-04T11:49:04.312-04.00

    Basil wrote:
    I think all are getting confused with my question, I dont want to know how to convert date
    to a a particular format, I want to know if there is any format for 2008-11-04T11:49:04.312-04.00
    like yyyy-MM-dd'T'HH:mm:ss.SSS for 2008-11-04T11:49:04.312. My JDK version is 1.4
    Edited by: Basil on Nov 4, 2008 7:43 AM
    Edited by: Basil on Nov 4, 2008 7:43 AMRead the link for SimpleDateFormat and make one. How is that hard to understand? And it is what you have been being told from the beginning, and would have realised had you actually read the API docs pointed to. All the information you need to do so is there.

  • Simple Date Format

    Hi,
    I have an entity object with some attributes, one of them is called "CREATED_ON", which i have specified as a history column (created on).
    I have specified a format type of Simple Date in my Control hint and a format of dd-MM-yyyy. I then created a view based on my entity and dragged the view as an adf creation form. I also dragged a commit button to commit my record.
    However, the date that is stored in my database have a non-zero time component (e.g. 10-JUL-2007 10:46:22). This is a problem becuase in my search form, the search criteria does not work (it requires the exact time also to work). I do not want to use TRUNC in my SQL query.
    Instead i want the date to be stored with the format mask that i have specified.
    Can you please help me?
    Thank you

    Do you really want to lose the time component altogether, or just make the query on date-without-time work?
    There would be no way of recovering the information about when during the day the row was created if you truncate the time information, but it's possible to achieve if that's what you want. Both are possible to achieve.
    To achieve the "losing the current time info forever" approach, add the following overridden method in your entity impl class that slightly changes the way the history attribute value is returned, in my case, for the HIREDATE attribute of an Emp example:
        protected Object getHistoryContextForAttribute(AttributeDefImpl attributeDefImpl) {
            Object ret = super.getHistoryContextForAttribute(attributeDefImpl);
            if (attributeDefImpl.getIndex() == HIREDATE) {
                ret = new Date(new java.sql.Date(((Date)ret).getValue().getTime()));
            return ret;
        }To achieve # 2 instead, just add a SQL-derived attribute to the view object with formula:
    TRUNC(HIREDATE)and then use that sql-derived attribute in the query form instead of the normal HIREDATE attribute.

  • Simple date format update/cleansing not working

    Dear All,
    Some rows are not being updated after update
    create table X(
    Surname varchar2(20),
    dob varchar2(20),
    dobupdate varchar2(20));
    insert into X values('Hookman','22-Apr-78','22-Apr-78');
    insert into X values('Beverly','21/06/1966','21/06/1966');
    insert into X values('Wickham','01/23/1985','01/23/1985');
    insert into X values('Logmann','26/Dec/1972','26/Dec/1972');
    insert into X values('Scooby','30.04.1966','30.04.1966');
    insert into X values('Trumph','15-August-1967','15-August-1967');
    insert into X values('Delaware','Aug-03-1961','Aug-03-1961');
    insert into X values('Wicked','03.Sep.1961','03.Sep.1961');
    insert into X values('Orlando','18.September.1961','18.September.1961');
    SURNAME DOB DOBUPDATE
    Hookman 22-Apr-78 22-Apr-78
    Beverly 21/06/1966 21/06/1966
    Wickham 01/23/1985 01/23/1985
    Logmann 26/Dec/1972 26-DEC-1972
    Scooby 30.04.1966 30-APR-1966
    Trumph 15-August-1967 15-August-1967
    Delaware Aug-03-1961 03-AUG-1961
    Wicked 03.Sep.1961 03-SEP-1961
    Orlando 18.September.1961 18.September.1961
    9 rows selected.
    =====================================
    --Code below is meant to update person Beverly
    Update x set dobupdate = to_char(to_date(dobupdate,'DD/MM/YYYY'),'DD-MON-YYYY')
    where dobupdate like '__/__/____';
    error - not valid month
    =======================================================
    --Code below is meant to update person  Trumph
    Update x set dobupdate = to_char(to_date(dobupdate,'DD-MONTH-YYYY'),'DD-MON-YYYY')
    where dobupdate like '__-_____-____';
    0 row/s updated
    =========================================================
    --Code below is meant to update person Orlando
    Update x set dobupdate = to_char(to_date(dobupdate,'DD.MMMM.YYYY'),'DD-MON-YYYY')
    where dobupdate like '__._____.____';
    0 row/s updated
    Where am I going wrong. I hvae no problems with updating other records in the table except fot just these three patterns.
    Help please.
    Cube60

    Thanks Warren, both suggested codes did not work and I can see why now. Alex has pointed it out.
    Alex brought me to realise Wickham's DOB is in the American format. The update query could not resolve that format and how to update it but at least it could have updated that of Beverly and left that of Wickham.
    After deleting Wickham completely, the update query worked on Beverly.
    Am just doing some data cleansing from a poorly designed Access database now meant for Oracle.
    So nothing can be done to resolve such mixture of date formats, I mean Uk and American.
    But now, Why are the update statement below coming with 0 records updated.
    The dates to be update are written like this 15-August-1967 and 18.September.1961 respectively
    --Code below is meant to update person Trump
    Update x set dobupdate = to_char(to_date(dobupdate,'DD-MM-YYYY'),'DD-MON-YYYY')
    where dobupdate like '__-__-____';
    0 row/s updated
    =========================================================
    --Code below is meant to update person Orlando
    Update x set dobupdate = to_char(to_date(dobupdate,'DD.MMMM.YYYY'),'DD-MON-YYYY')
    where dobupdate like '__._____.____';
    0 row/s updated
    many thanks
    cube60
    Message was edited by:
    cube60

  • How to define the date format for this date string

    2006-11-13 00:00:00.0
    How to define the date format in control file for sqlldr. "yyyy-mm-dd hh24:mi:ss" or "yyyy-mm-dd hh24:mi:ss.FF1" does not work
    thanks,

    SQL> desc t
    Name                                      Null?    Type
    TS                                                 TIMESTAMP(6)
    SQL> !cat t.ctl
    load data
    into table t
    truncate
    (ts timestamp "YYYY-MM-DD HH24:MI:SS.FF1")
    SQL> !cat t.dat
    2006-11-13 00:00:00.0
    SQL> !sqlldr userid=scott/tiger control=t.ctl data=t.dat log=t.log
    SQL*Loader: Release 10.2.0.3.0 - Production on Fri Sep 7 11:19:28 2007
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 1
    SQL> select * from t;
    TS
    13-NOV-06 12.00.00.000000 AMBest regards
    Maxim

  • Help :  Simple Date Formats Problem in JDev11 [TP4] ?

    Hi ;
    I use ADF/JSF in JDeveloper 11 [TP4].
    in JSF Page
    what can I do to enter Date format mask dd-mm-yyyy hh:mi:ss
    to Return my Date Format mask like
    mi-mm-yyyy meaning minute-month-year
    in another column ?
    and I know The format mask is defined in a File called formatinfo.xml .
    Thanks & Regards
    Forakora

    Hi,
    if it is for display then you don't need to change it in the model but can link the output text component to a managed bean that gets the stored date value to then change it to the format you prefer. This however may not be suitable if the date should be updated from that column

  • Reading simple date format

    Hi,
    I am attempting to use the simpledateformat in Java. I want it to read the inputted code, and store it, and then print it out again...
    Here is what I have so far:
    import java.util.*;
    import java.text.DateFormat;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    public class Date     {
         //For date :
         static DateFormat df = new SimpleDateFormat("dd-mm-yyyy");
         public static void main(String[] args)
              //for date in form (dd-mm-yyyy)
              //reads input fromm keyboard
              Scanner data = new Scanner(System.in);
              //Asks for you to type in date.
              System.out.println("Useby date: (dd-mm-yyyy)");
              //Takes input as string value
              String input = data.next();
              Date useby = null;
              try
                   useby = df.parse(input);
              catch (ParseException e)
                   e.printStackTrace();
              //Prints useby date.
              System.out.println("Useby date: " + df.format(useby));
    The line:
                   useby = df.parse(input);
    States that there is a type mismatch... "cannot convert from Date to Date"??? What does this mean???
    I am unsure as to what all these lines mean as I got them off the net and was unsure about some of them...
    If some1 could help it would be very much appreciated.
    Thanks.

    I think your code is getting confused between java.util.Date and your own class's name, which is Date. Rename your class, and you should be fine.
    By the way, please use code tags when posting code. See CODE button above posting box. That will format your code such that it is much more readable.

  • Simple date format with 1st 2nd 3rd etc

    hai
    i want to dispaly the date in the format
    25th of December 2004
    i tryed to format in SimpleDateFormat, but there is not special format to display date as 1st 2nd 3rd.
    can anybody help me how to do this
    Archi

    THANKS YOU
    THANKS FOR YOUR VALUABLE RESPONSE
    THAT I KNOW VERY VERY WELL HOW TO DO THAT.
    ITS URGENT I DONT WANT TO WASTE TO "INVENT A NEW STUFF"
    ARCHI.

  • Simple Date Format problem

    I am having trouble with the following code. It works fine on one computer but not on another.
    Calendar cal = Calendar.getInstance(TimeZone.getDefault());
    Date date22 = cal.getTime();
    System.out.println(date22);
    String details = sdf.format(date22);
    System.out.println(details);
    StringTokenizer str = new StringTokenizer(details, "-", false);
    The working ones output is:
    Thu Jul 14 12:06:33 GMT 2005
    14-07-2005-12-06-33
    However on the computer where it doesn't work, I get this:
    Fri Aug 05 13:13:59 BST 2005
    Exception in thread "Thread-0" java.lang.NullPointerException
    Which point to line: String details = sdf.format(date22);
    From what I can see, the only difference is BST instead of GMT, but I can't seem to change this.
    It is running under Windows.
    Any help will be MUCH appreciated, as I am stumped!
    Thanks. :)

    The difference is that in the latter sdf is never assigned a non-null value. Since you didn't post the code that initializes sdf, we've got no way of knowing what went wrong.

  • Regarding java.util.date / simple date format

    Hi Friends,
    I have a weired requirement where I am suppose to get time in millisecond for 3 scenarios.
    1. next 07:00 time
    2. next monday 07:00
    3. on next 1st 07:00
    Swing provides some jar where I can get next day - but not sure if I can play around to get my data.
    need your inputs.
    appreciate your quick reply friends,
    Chintan
    P.S. the reason I have to do so is
    1. I have 3 kind of reports - few reports expire daily - few weekly - few monthly.
    2. I am going to fetch the report from the external system and store (cache) in my db.
    3. Administrator can configure that when exactly the report is going to be updated in external system.
    4. So lets say for daily - every day at 7 it will be updated - so when I read the cached data, I want to compare the stored time stamp with next 7:00 time stamp and if my stored timestamp is less than next 7:00 time stamp - i can use the cached data and similarly for weekly and monthly.
    Please let me know if you have more questions.

    I'll just add an example.
    say I added a report to DB at 1188563489217 and my
    cutoff is weekly that is on next monday at 7:00 in
    the morning - at that time my milliseconds would be
    1188783033888
    now as far as my stored milliseconds are less than
    1188783033888 i can read it from my db and if my
    stored milliseconds are greater than 1188783033888
    then I need to refetch the report.
    Now for this task - every time i make a call to my DB
    - i have to get time in milli seconds for next monday
    7:00.
    Is it possible??
    I am badly struck over here - please guide.
    Chintan
    Appreciate your help buddies.
    ChintanTake the hint if the date string is 35:11:2007 07:00 in dd:MM:yyyy HH:mm format then the parsed date will be 05:12:2007 07:00.
    your problem is actually a piece of cake ;-)

  • Date format - need this format --  04/04/2002 - need help?

    Hi, I am trying to get the date into this format 04/04/2002, so I can insert into the database...
    I have this code.. but it display it like this - Apr 4, 2002
    Date t = new Date();
    String today = DateFormat.getDateInstance().format(t)
    Thx
    Rich

    Or because today is the 4th day of the 4th month maybe :
    java.util.Date t = new java.util.Date();
    java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("MM/dd/yyyy");
    System.out.println(df.format(t));

  • Simple Date Formatting

    I am a newbie to Java and was wondering if anyone knew of a easy way to format and date without having to write a whole function to format a date??

    I need more information what you are trying to do?
    Do you want to convert a string to a date are a date in one format to other.
    I suggest you to go through the following class API
    SimpleDateFormat
    Hope this will help you get some info about formatting
    Happy Coding
    Sampath

  • Format date with simple date format

    Hello
    I want to parse String to date. My method is
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    Then
    Date date = dateFormat.parse("2007-17-1100 11:11");
    It can be seen that the String "2007-17-1100" is invalid date. However, I donot know why it still can be parsed. Result is "Thu May 05 11:11:00 NZST 2011"
    Could you please explain. I want this one cannot be parsed.
    Many thanks
    shoa

    SimpleDateFormat dateFormat = new
    SimpleDateFormat("yyyy-MM-dd HH:mm");
    Then
    Date date = dateFormat.parse("2007-17-110011:11");
    >
    IIn my knowledge there is only 12 months in a Year.There are. But as long as the parsing is 'lenient' it knows how to handle month numbers greater than 12.
    @OP: Check out the setLenient() method. A setLenient(false) should make it work the way you want.

  • Simple date format probem

    i wrote a method to convert a String to Calendar, but i have an error.
    The calendar object generated always has the month set to january and i don´t know why.
    This is my code
         static SimpleDateFormat df=new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
                          public static Calendar dateString2Calendar(String s) throws ParseException {
              Calendar cal=Calendar.getInstance();
              Date d1=df.parse(s);
              cal.setTime(d1);
              return cal;
         }  if the source String is: 2008-09-04 17:54:09 my Calendar gets the value: Fri Jan 04 17:54:09 CET 2008
    Where is my mystake?
    Regards

    upps i am feeling very very stupid....
    anyway thanks BigDaddyLoveHandles !!!!!!!

Maybe you are looking for

  • DTN - Hide top node

    I have created my site navigation and it has four nodes NODE ONE contains two nodes -> NODE TWO AND NODE THREE NODE TWO contains one node -> NODE FOUR NODE ONE is a second level navigation item so the user would click the NODES Tab and see NODE ONE T

  • Converting html course to destop mac application

    Hi, I have experience in Flash. I have created an html course using Lectora. Course is having external html popups which contains pdfs. Now my client want to convert this html course to desktop application for mac. Is this possible with Adobe air.  

  • Launching Photoshop Launches Quicken installer

    I recently installed the CS2 upgrade. After a week or so, when I click to open it, for some reason a Quicken installer opens too. Not only that, but under file>automate, all the selections are duplicated and do not work properly (I needed photomerge

  • How to upgrade to Ps CS5 on new iMac

    Hello- I'm anticipating my new iMac i7 anyday. I want to upgrade to Ps CS5 to the new system, not my current old iMac which I have CS2 on. Since this is an upgrade will that be possible? Can I buy CS5 & install directly to the new iMac or do I have t

  • Multiple CSS Styles For Links

    I know it's common to create multiple styles for all the fonts on a website but how can I create multiple styles for links where one if you hover it'll turn red and another link it'll turn blue?