Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

convert date format

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
hi all,
can anyone tell how to convert string as-> Tue Nov 02 00:00:00 IST 2010 to date format of same type or to get date in ist format in java
 
Ranch Hand
Posts: 121
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
The format already is giving you date if you want it in another format use Calendar class
If you want some thing like 22/5/2010 .
or anything else
The date is already in the IST form .
If you want some one to enter the string and than you want to format the part user entered
Use a method
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Nisha Kala wrote:hi all,
can anyone tell how to convert string as-> Tue Nov 02 00:00:00 IST 2010 to date format of same type or to get date in ist format in java



I had told about SimpleDateFormat in my reply to other query. You can have a look at the API for SimpleDateFormat: http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html

Edit: Also the String which you are going to parse in to Date should be in the required format other wise it will throw ParseException. For example- You have a String in- 10-11-2010 format and then try to parse it to- Tue Nov 02 00:00:00 IST 2010 will result in an exception.
 
Marshal
Posts: 71729
312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

mohamed sanaullah wrote:[ . . . my reply to other query. . . .

Thank you for drawing that to our attention. I shall close this thread as a duplicate.
 
    Bookmark Topic Watch Topic
  • New Topic