• Post Reply Bookmark Topic Watch Topic
  • New Topic

time type in java?  RSS feed

 
alain martin
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • 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
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I only need manage hours and minutes, but millisecons are not problem.

What is more common to use?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • 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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!