Skip to content
Advertisement

Tag: time

Conversion from 12 hours time to 24 hours time in java

In my app, I have a requirement to format 12 hours time to 24 hours time. What is the method I have to use? For example, time like 10:30 AM. How can I convert to 24 hours time in java? Answer Try this: which produces: See: http://download.oracle.com/javase/1.5.0/docs/api/java/text/SimpleDateFormat.html

How to calculate “time ago” in Java?

In Ruby on Rails, there is a feature that allows you to take any Date and print out how “long ago” it was. For example: Is there an easy way to do this in Java? Answer Take a look at the PrettyTime library. It’s quite simple to use: You can also pass in a locale for internationalized messages: As noted

GPS Time Representation library

I am looking for a Java library that handles conversion to/from GPS Time. GPS Time has an epoch of 6 January 1980, and does not have leap seconds, so it differs from the more standard time representations. Here is the relevant description from wikipedia: While most clocks are synchronized to Coordinated Universal Time (UTC), the atomic clocks on the satellites

Advertisement