A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Java
»
Java in General
Author
Convert string to date format YYYYMMDDHH24MISS
suju hande
Greenhorn
Joined: Dec 18, 2001
Posts: 1
posted
Mar 18, 2008 19:57:00
0
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
cheers,<BR> sujata
Francois Dang Ngoc
Greenhorn
Joined: Sep 02, 2007
Posts: 6
posted
Mar 18, 2008 22:33:00
0
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
I agree. Here's the link:
http://aspose.com/file-tools
subject: Convert string to date format YYYYMMDDHH24MISS
Similar Threads
Code review required for converting dateformat
sql date convert
Doubt in SimpleDateFormat
How to convert this String into a readable date?
SimpleDateFormat
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter