Note that there are some explanatory texts on larger screens.

plurals
  1. POStoring simple hour/minute information in Java - best practice question
    primarykey
    data
    text
    <p>I've been looking at different methods to store time in Java and I can't quite find the right implementation for my needs.</p> <p>I want to store information about our courses schedule, this information mainly consists of a starting and ending time(start:HH:MM end:HH:MM). Now I will be using this data throughout the code to create the different views and logic behind the app.</p> <p>For now I've implemented it using the GregorianCalendar class which works fine but at each input of a course I end up using a <strong>default date for all</strong> + time, I then proceed on ignoring the date completely throughout the application.</p> <p>I'm trying to develop better coding habits and was wondering how you would solve this problem. In our courses we get hammered on the head daily with good practices, OO development and using built in tools and library's when we can, but does this apply in such a situation?</p> <p>should I: </p> <ol> <li>Implement my own class storing hours and minutes with all the required integrity checks etc...</li> <li>Stick to what I have, it's not pretty but better than reinventing the wheel.</li> <li>There is this amazingly clean and simple solution I've overlooked and everyone knows about.</li> </ol> <p>Now obviously I'm not expecting a black and white answer here but more of a guideline in how to approach such problems.</p> <p>EDIT:</p> <p>I'm the original poster, I since registered an account but can't actually submit anything since I am not linked to the post.</p> <p>After careful consideration I believe that building my own solution to store this information is the easiest and most intuitive approach, the tools that exist are brilliant but much more complex than the information I actually need and will probably lead to more bloated code to extract the items I require.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload