Results 1 to 6 of 6

Thread: How to convert String to Date

  1. #1
    Ext User
    Join Date
    Mar 2009
    Posts
    40
    Vote Rating
    0
      0  

    Default How to convert String to Date

    Hi,
    I want to convert String to Date without using DateFormat and SimpleDateFormat. Kindly help me how to do this.

  2. #2
    Sencha Premium User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    888
    Vote Rating
    1
      0  

    Default

    You can use Date Deprecated methods...
    Calendar is not available on GWT.

    Why can't you/don't you want to use DateFormat?

  3. #3
    Ext User
    Join Date
    Mar 2009
    Posts
    40
    Vote Rating
    0
      0  

    Default

    I don't want to use DateFormat, so kindly tell me any other method with an example.

  4. #4
    Sencha Premium User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    888
    Vote Rating
    1
      0  

    Default

    As I said before, since you don't want to use DateFormat, you can then parse your String into day/month/year/hours/minutes

    and then set a Date object using that (setDate, setMonth, setYear, setHour, setMinutes)
    Those methods are deprecated, but they will work...

  5. #5
    Ext User
    Join Date
    May 2010
    Posts
    1
    Vote Rating
    0
      0  

    Default how to convert a string to date

    Java Solution:
    http://www.roseindia.net/java/java-c...eExample.shtml

    GWT Solution:
    String time1 = "05/10/2010"
    com.google.gwt.i18n.client.DateTimeFormat dtf = com.google.gwt.i18n.client.DateTimeFormat
    .getFormat("MM/dd/yyyy");

    Date date1 = dtf.parseStrict(time1);

  6. #6
    Sencha Premium User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    888
    Vote Rating
    1
      0  

    Default

    Hi, that example is not valid in the Gwt world.

    Gwt does not emulate no method in java.text

    Regards,
    Michel.

    PS: I don't see a point on resurrecting a 1 year old message....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •