• 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

time type in java?

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a time type in java? If it doesn't exist how is the best way to manage it? string type, date type, string?

Thanks
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What functionality are you looking for specifically? The java.util.Date class supports time down to the millisecond level, java.sql.Timestamp even down to the nanosecond level.

As an alternative, there is a library called "Joda Time", which is supposed to be a better implementation of date and time functionality than the Date and Calendar classes offer.
 
alain martin
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I only need manage hours and minutes, but millisecons are not problem.

What is more common to use?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at the API documentation of the classes java.util.Date and java.util.Calendar - those are the standard, and most commonly used, classes for dealing with dates and times in Java.

Specifically for working with dates and times for databases, use java.sql.Date or java.sql.Timestamp.
 
reply
    Bookmark Topic Watch Topic
  • New Topic