• Post Reply Bookmark Topic Watch Topic
  • New Topic

Suitable way to send date& time to Database and retrive using JSP  RSS feed

 
Gerald Leonard
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All, am new in jsp; I have a project in jsp.
I want to set a date and time calendar in an input box and send to my Database(Mysql) in XAMPP platform
in the format YYYY-MM-DD HH:mm later view the date and time from the database.

kindly, in need of your help...
Thanks!!
 
Mauro Trevigno
Ranch Hand
Posts: 99
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gerald,

You can show in your input in one way and when you submit your form, you get the parameter and can change the format the way you need to send you db.

-Mauro.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66156
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the type of the column in which the date will be stored? Most often a DATETIME or TIMESTAMP type is used in which case you would convert the string parameter to a Date type to send th the DB.

You might also need to do some timezone massaging to store the value as UTC if that's what is expected. Otherwise the DB assumes the timezone of the DB server.
 
Gerald Leonard
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a form with an input which I want to put date
using calendar and send it to database and retrive later;
but I have no Idea how to go about..

please any help!!!
 
Mauro Trevigno
Ranch Hand
Posts: 99
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use HTML 5.

<input type="date" name="bday" max="1979-12-31">

Or some external API like Jquery datepicker.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66156
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You still haven't answered my questions.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!