Skip to content
Advertisement

Tag: datetime

Get last week date range for a date in Java

Suppose I have a Date 20 June 2013 How can I get the Date range for the last week, ie in this case 9 June to 15 June. Also if the date was 2nd June 2013 the range should be 26 may to 1 june Answer this is Java Calendar based solution output it’s localized, in my Locale week starts

Removing time from a Date object?

I want to remove time from Date object. But when I’m converting this date (which is in String format) it is appending time also. I don’t want time at all. What I want is simply “21/03/2012”. Answer The quick answer is : No, you are not allowed to do that. Because that is what Date use for. From javadoc of

Unparseable date exception in java

These lines of codes causees this exception what is the possible solution ? Answer Your format is completely wrong. Not only are you using mm (which means minutes) when you probably meant MM, but this: is clearly not in the format You probably want something like EDIT: That works for me in desktop Java: You may want to set the

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

Convert Month String to Integer in Java

Given a month string such as: Is there any core Java or third party library functionality that would allow you to convert this string to the corresponding month number in a locale agnostic way? Answer An alternative to SimpleDateFormat using Joda time:

Advertisement