File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Want to show the TimeStamp on the form, but needs to save it back later Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Want to show the TimeStamp on the form, but needs to save it back later" Watch "Want to show the TimeStamp on the form, but needs to save it back later" New topic
Author

Want to show the TimeStamp on the form, but needs to save it back later

Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 580
When a complaint form shows up, I'd like to show the timestamp, do I get this from Java or MariaDB,

If from Java, I need to update this value and set the field type to DateTime

If from MariaDB, I need a stored procedure to generate a TimeStamp and display it on the form and save it back later.

Both seems very inlogical, what is the proper way of doing this?
Thanks
Jack
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29241
    
139

In Java, "new java.sql.Date()" creates the current date/time. You can then call stmt.setDate(1, new java.sql.Date()) to insert it in your database table.

I'm not familiar with stored procedures in MariaDB, but I'm sure it is possible. "now()" is often a database way of getting the current time.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Want to show the TimeStamp on the form, but needs to save it back later
 
Similar Threads
jframe form issue
How would I do a all-round searching for all tables of the database?
TimeStamp.toString() does not work as expected
MariaDb vs Mysql from java developers view!
f:convertDateTime and data type conversion