Jquery and sqlite

Jquery and sqlite

Hello everyone,
I am building an offline application using sqlite on phonegap, and my Jquery versions are 1.2 for mobile and 1.8.  My code did not work, i don't know if this is the right way to store date into database. The timeFunction is called on 4 different buttons depending on which button the user clicks. For example, if morning button is clicked and then the the ok button which calls the timeFunction is cliked, i wouls like the data to be stored in the morning column. Below are both codes. The first one stores date and time into the sqlite table while the second stores the time the user inputs into the table. Please, i need help on how to do this and how to create alarm when it is time.

  1. function dateFunction(){
  2. //insert a record for time and date, called when clicked(save/ submit) a btn.
  3.     
  4. var d = new Date();
  5. dt = d.setFullYear($('year').val()),d.setMonth($('month').val()), d.setDate($('day').val());
  6. dt.format("yyyy/mm/dd");
  7. if(dt!="" && dt==true){
  8. db.transaction(function (tx) 
  9. { tx.executeSql(insertStatement, [Date], loadAndReset, onError); });
  10. }
  11. }


  12. function timeFunction(){
  13.   var hourMinute= new Date().setHours($('#hour').val())+":"+ new Date().setMinutes($('#minute').val());
  14.   if(hourMinute !="" && $('#hour').val()>=5&&$('#hour').val()<=12)
  15. {
  16. db.transaction(function (tx) { 
  17. tx.executeSql(insertStatement, 
  18. [morningTime], loadAndReset, onError); });
  19. }
  20. if(hourMinute !="" && $('#hour').val()>=12&&$('#hour').val()<=17)
  21. {
  22. db.transaction(function (tx) { 
  23. tx.executeSql(insertStatement, 
  24. [afternoonTime], loadAndReset, onError); });
  25. }
  26. if(hourMinute !="" && $('#hour').val()>=18&&$('#hour').val()<=20)
  27. {
  28. db.transaction(function (tx) { 
  29. tx.executeSql(insertStatement, 
  30. [eveningTime], loadAndReset, onError); });
  31. }
  32. if(hourMinute !="" && $('#hour').val()>=21&&$('#hour').val()<=23)
  33. {
  34. db.transaction(function (tx) { 
  35. tx.executeSql(insertStatement, 
  36. [nightTime], loadAndReset, onError); });
  37. }
  38. }