Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How should i save days, hours, and minutes using date datatype or other datatype

 
Jhon Parker
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a java application that schedule some jobs, the user have a graphic interface when they can put the numbers of days, the number of hours or the number of minutes. when they want the job to be executed. Example: a user can select i want my job to be executed every 4 days and 2 hours and 30 minutes.



I have 3 columns in a table where i would store this values like this


;

I'm not sure about how to do this, is there a way to only insert days using the date datatype, or only save the hours, or only save the minutes.

How should i do this?
I use interval day(100) to second(0) but i don't know what this means i taked that from some web site but i don't know how that work. Any suggestion would be apreciated even if i you suggest using other data types

 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not save it as 3 (tiny)ints?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or save it as 1 int: the total number in minutes or (milli)seconds?

Using TimeUnit class you can easily convert these values back and forth if needed.
 
Jhon Parker
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i used tiny ints, and added those tiny ints to my dates like this

select sysdate, sysdate+1/24, sysdate +1/1440, sysdate + 1/86400 from dual
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic