• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not save it as 3 (tiny)ints?
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic