This is the code and the mysql table
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/2a", "root", "root");
Statement st=con.createStatement();
ResultSet rsta=st.executeQuery("Select * from data");
while(rsta.next()) {
x14=rsta.getTime("strtime");
}
%>
<div id="TextBoxesGroup">
<input type="hidden" id="time" name="time" value="<%=x14%>"/>
</div>
<script>
$(document).ready(function(){
var dateString=$('#time').val();
var d1 = new Date(dateString);
var newTextBoxDiv = $(document.createElement('div'))
.attr("id", 'TextBoxDiv' + counter);
newTextBoxDiv.after().html('<div><label style="float:left;">'+d1+'</label>);
newTextBoxDiv.appendTo("#TextBoxesGroup");
</script>
+---------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| date | date | YES | | NULL | |
| strtime | time | YES | | NULL | |
| endtime | time | YES | | NULL | |
| freq | varchar(30) | YES | | NULL | |
| inter | int(11) | YES | | NULL | |
+---------+-------------+------+-----+---------+----------------+
The variable d1(it is saved as time in db) gives me invalid date.why is this happening?Am I missing something?
Let me know incase more info is required but do help.