Linked Questions

1011 votes
17 answers
2.4m views

Java string to date conversion

What is the best way to convert a String in the format 'January 2, 2010' to a Date in Java? Ultimately, I want to break out the month, the day, and the year as integers so that I can use Date date = ...
littleK's user avatar
  • 19.8k
2 votes
1 answer
26k views

What is date format of EEE, dd MMM yyyy HH:mm:ssZ? [duplicate]

I'm trying to parse this on Android: Fri, 02 Oct 2015 10:01:00+0300 with this format EEE, dd MMM yyyy HH:mm:ssZ, but doesn't work. item_date = "Fri, 02 Oct 2015 18:07:00+0300"; SimpleDateFormat ...
NickUnuchek's user avatar
  • 12.4k
6 votes
2 answers
14k views

java.text.ParseException: Unparseable date: "" (at offset 0) [duplicate]

I've read many answers to this problem but no answer solves my problem I am trying to parse this string : "2013-10-07T23:21:00+01:00" to a Date object with the simpledateformat : "yyyy-MM-dd'T'...
theanimashaun's user avatar
0 votes
4 answers
3k views

How do I parse "dd.MM.yyyy G" to ISO-Date in Java? [duplicate]

Hey guys I have the date "01.01.1000 AD"(SimpleDate) as String and dd.MM.yyyy G(SimpleFormat) and need to parse it into a Standard ISO-Date in the form 1995-12-31T23:59:59Z (yyyy-MM-dd'T'hh:mm:ss'Z') ...
Sebastian Röher's user avatar
0 votes
2 answers
358 views

SimpleDateFormat: Unparseable date MMMM yyyy [duplicate]

I need to parse the string "October 2015" but I´m getting a java.text.ParseException. I've been looking for an answer but all the examples I've seen include the "day" within the string. I need to ...
Lorena Pita's user avatar
  • 1,446
0 votes
2 answers
135 views

Best way to transform date string into an date object [duplicate]

What is the best way to transform like October-2016 into an Date Object? When I try to use Date date = new SimpleDateFormat("MMMM-yyyy").parse("October-2016"); it throws an exception, because it ...
SepDev's user avatar
  • 153
0 votes
1 answer
74 views

Unparseable datefrom string [duplicate]

I have a date time string like this: Java Code: String datetimeString = "Tue Apr 10 15:19:06 CEST 2018"; I would like to convert this to a date like this: 2018-04-10 How can I do this? I have tried ...
iabu's user avatar
  • 1
0 votes
0 answers
92 views

Convert Java String to Date in a Format [duplicate]

How can I convert a Java string to a date in this format - "31 Jan 2022". I've tried the code below. Date sDate; SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy"); sDate ...
Felix 's user avatar
22 votes
4 answers
17k views

how to parse output of new Date().toString()

I need a date format (maybe SimpleDateFormat) that parses reliable the output I get when I call toString() on a Date object. Output on my german(!) system is: "Sun Dec 12 13:45:12 CET 2010", so it ...
Daniel's user avatar
  • 27.9k
8 votes
5 answers
127k views

Convert java.util.date default format to Timestamp in Java

The default format of java.util.date is something like this "Mon May 27 11:46:15 IST 2013". How can I convert this into timestamp and calculate in seconds the difference between the same and current ...
swateek's user avatar
  • 7,190
0 votes
3 answers
12k views

How to convert Standard Date into minutes in java?

How to convert standard output of date into number of minutes? I have output from my command as: Mon Mar 4 12:33:58 2013 and I need to convert it into number of minutes say minutes1. because I ...
mac's user avatar
  • 11
1 vote
3 answers
5k views

changing string to Calendar object value.

I am having string date = "2014-09-11". i want to set this string to calendar object. The string value is already having "-" in it. So how to use date formatting?
pratz9999's user avatar
  • 539
0 votes
4 answers
3k views

offset Java time by a number of seconds

here is what I would like to do: I have a date/time as a string, something like "January 2, 2010 10:25:30". The format is defined by localeLang (en, ja, unix, etc) and localeCountry (US, JP, etc). ...
Catalin Demergian's user avatar
-2 votes
3 answers
5k views

How to convert a Gregorian calendar date format to Julian date format?

I want to convert dd-MON-yyyy to Julian date as part of SQL query against JDE. It would be of great help if anyone could guide on how to achieve this. new JulianDate().ConvertToJulian(date1) worked ...
user7324003's user avatar
-3 votes
1 answer
2k views

Simple way to convert "yyyyMMdd"-formatted string into a GregorianCalendar object

I see plenty of questions for taking a GregorianCalendar or Date object and printing a "yyyyMMdd"-formatted string. However, I want to go the opposite direction. I have a "yyyyMMdd"-formatted string,...
Andrew's user avatar
  • 21k

15 30 50 per page