Click here to Skip to main content
15,910,787 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
Insert into PEPSIRENDEEMHISTORY(PIN,STATUS,CURRENTDATE,MSISDN,USERNAME,SIM)
VALUES ('4501664170',1,'5/12/2013 8:05:26 PM','2348121846632','ranjith-PC\ranjith',1)


Problem with date time while inserting showing not valid month
Posted
Updated 12-May-13 10:14am
v2

 
Share this answer
 
Comments
Maciej Los 12-May-13 16:24pm    
Great! +5
Zoltán Zörgő 12-May-13 16:24pm    
Thanks :)
Ranjith Kumar 12-May-13 16:33pm    
CAN U SHARE SOME SAMPLE EXAMPLES PLZ THE DATEFORMAT SHOULD BE IN MM/DD/YYYY EXAMPLE 05/12/2013
Maciej Los 12-May-13 16:35pm    
Did you try to change it at all?
Zoltán Zörgő 12-May-13 16:36pm    
Don't shout = don't use all caps!
There you have the whole list: http://www.techonthenet.com/oracle/functions/to_date.php
But mm/dd/yyyy is a valid format. You just need to specify the format.
Get That in in your java code.and use SimpleDateFormat class specify the format of ur date format then convert that one into util date format then convert that one into timestamp format then it will inserted into database with date and time
 
Share this answer
 
use syntax like this.

to_date('2011/04/22 08:30:00', 'yyyy/mm/dd hh24:mi:ss')

for you its like
SQL
Insert into PEPSIRENDEEMHISTORY(PIN,STATUS,CURRENTDATE,MSISDN,USERNAME,SIM)
VALUES ('4501664170',1,to_date('2011/04/22 08:30:00', 'yyyy/mm/dd hh24:mi:ss'),'2348121846632','ranjith-PC\ranjith',1)


-SG
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900