Regards, Rene Larsen
Originally posted by Rene Larsen:
You need to insert a 'java.sql.Date' into 'ps.setDate(1, ...)'
Never try to be a hard-worker. Be a smart-worker.
My Blog
Originally posted by Rajkumar balakrishnan:
I want to insert the current date into table, but i don't know how to accomplish that.. Please post me some code here..I am in
Please help me..........
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Originally posted by Shailesh Chandra:
Thanks,
Shailesh
Never try to be a hard-worker. Be a smart-worker.
My Blog
Originally posted by Rajkumar balakrishnan:
Thanks for that... And now a silly question is this one stores the time in milliseconds where i need it to be stored in yyyy-MM-dd format so that i can able to view it in reports.... Please help me regards this
Regards, Rene Larsen
Originally posted by Rene Larsen:
If you need to show the date in a special format, you need to use SimpleDateFormat to format the date/timestamp returned fra the database.
Never try to be a hard-worker. Be a smart-worker.
My Blog
Regards, Rene Larsen
Originally posted by Rene Larsen:
To be able to store the date as a String (varchar) in the database, you need to verify that the data type for the 'date' field is a varchar - or you have to change it from date/timestamp to varchar.
Here is how you put a Date as a String into the database:
Never try to be a hard-worker. Be a smart-worker.
My Blog
Originally posted by Rajkumar balakrishnan:
I don't want to change the field from date to varchar or something else..
So please help me inserting the current date with the required formatting....
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Originally posted by Shailesh Chandra:
Why are you so specific about format, A date is stored in database as Date object not with its format. A format is only representation of date as string.
I suggest let the date be stored as Date and if you want to display same in a specific format is as Rene has suggested above. That would be an ideal approach.
Thanks,
Shailesh
Never try to be a hard-worker. Be a smart-worker.
My Blog
snakes are really good at eating slugs. And you wouldn't think it, but so are tiny ads:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|