Try java.sql.Timestamp.
RTFM for the differences between Date, Time, and Timestamp.
- Dan

> -----Original Message-----
> From: Raj Yadav [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 19, 2003 3:42 PM
> To: [EMAIL PROTECTED]
> Subject: [OT] Date Problem
> 
> 
>     Hi All,
> 
>     I have date stored in a flat log file like this:
> 
>     Mon Dec 15 00:00:52 2003
> 
>  
> 
>     I read the log file and get this date as a String.
> 
>     I want to insert this date into a Oracle table.
> 
>     My method is like this:
> 
>     public static java.sql.Date StringToDate(String date)
> 
>     {
> 
>     java.sql.Date retDate = null;
> 
>     try
> 
>     {
> 
>     String incomingDate = date;
> 
>     SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM d
> HH:mm:ss   
>     yyyy");
> 
>     java.util.Date d = formatter.parse(incomingDate);
> 
>     retDate = new java.sql.Date(d.getTime());
> 
>     System.out.println("retDate = " + retDate);
> 
>     //retDate = (java.sql.Date)formatter.parse(incomingDate);
> 
>     }
> 
>     catch(ParseException prsEx)
> 
>     {
> 
>     System.out.println("Parsing Exception in Utils = " + prsEx);
> 
>     }
> 
>     return retDate;
> 
>     }
> 
>  
> 
>     It is inserting only MM/dd/YYYY and not the time.
> 
>     How do i insert the whole date with the time
> 
>  
> 
>     thanks,
> 
>     -raj
> 
>  
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to