need some help! this is sort of a 2 part question..
ive done a decent amount of programming but ive never really worked with dates, ive googled and all that but finding nothing.
part 1:
so lets say i have some variable:
Public Date adStartTime
i want it to be in this format: yyyy/mm/dd hh:mm:ss
so i just do adStartTime = (some date formatter) + (2011/08/08 08:08:08) *which dont work
whats the proper way to get it to be that way?? i keep getting errors and such.. id prefer to do everything in Date instead of using strings/int..
part 2:
once i get the date in that format i will need to insert that into db, can i insert the date in that format? or will i need to change it?
reason i will need the time is because i am setting up automated ads for new company securities and sometimes the ad will run for one day or maybe 1/2 day so i will need to set the timer correctly.
thanks for any help..
For part 1, use a
java.text.SimpleDateFormat, like so:If you have code that looks anything like this, and still get errors, please edit your question to include your actual code.
For part 2, you should insert the date in the database as a Date, not as a String, so there is no format.