Hi; I have a jsp and passing start_date as a string with this format input string 2006-01-02 03:04:00 database timestamp: 2006-01-02 03:04:00
in the database, the java method expected Date '2006-01-02 03:04:00' as parameter . In the SQL it search like "select * from table where date1 >= '2006-01-01 12:13:00' and date2 <= '2007-01-02 12:13:00'"
Thanks Carol: i fixed it, but for example on my jsp i enter 2007-01-02 15:00:00 i ran through my code [see previous post], the output string is <b>Tue Jan 02 15:00:00 </b> not the format <b> "yyyy-MM-dd hh:mm:ss" </b> as I wanted? Any ideas how to fix this
You've got a String representing a date. (inputstring) You turn it into a Date. (d1) You turn it back into the String you started with. (mydt) Now you cannot turn it back into a date? (what is wrong with d1?)
On the jsp: there are two seperate field: Date, and Hour, User can enter date with format yyyy-MM-dd and Hour hh:mm:ss
When I got this two fields, i need to somehow reformat to be the whole thing yyyy-MM-dd hh:mm:ss,
I try to concate the string, but it won't work
So from the above code , you are saying that I just using d1 to passing into the method that epxect Date private String getSomething (Date myDate) // passing d1 in here, but I got stuck at the hour,minute,seconde.