I want to save time intervals in my SQL table but I’m not sure what type to use in Java for this.
What I need to store are durations like 12:33:57 or just minutes and seconds like 02:19. Any ideas what type I could use for java and for sql? I don’t really need to make any calculations with these values, but I would like to generate charts later on, with the lengths of the mesured times.
The mysql type you want is
TIME, ie:If you read such columns in via JDBC, you’ll get a
java.sql.Timeobject, which is actually ajava.util.Datewith only the time portion set (ie a time on1970-01-01)