aspose 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: 601
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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30919
    
158

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