• Post Reply 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Convert string to date format YYYYMMDDHH24MISS

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
probably this is a beginner question not sure so posted here.

I have to do 2 things
convert a string into YYYYMMDDHH24MISS format before passing it to a plsql function
i.e if the date is 12/15/2007
the output should be 20071215141239

i am stuck as to what pattern to use in SimpleDateFormat

DateFormat df = new SimpleDateFormat("yyyyMMddHH24MISS");
it fails here saying I is invalid.
Please help!!
Thanks in advance
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sujata,

> DateFormat df = new SimpleDateFormat("yyyyMMddHH24MISS");

If we look at the Java API (http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html), we have the following:
- H: hour in day (0-24)
- m: Minute in hour
- s: Second in minute

So the pattern can be defined as: yyyyMMddHHmmss

Hope it helps,

Cheers,

Francois
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic