Questions tagged [date-parsing]

Date-parsing refers to programming logic which reads one or more parameters, attempts to match it to a supported or specified date format, then returns the resulting Date if successful.

References

494 questions
-3
votes
1 answer

ParseException when using SimpleDateFormat.parse("yyyy-MM-dd")

My code looks as follows: (new SimpleDateFormat("yyyy-MM-dd")).parse("0000-12-25") This argument is supposed to pass a date object to a constructor, but I get a ParseException. I tried playing around with Locale.US and Locale.ENGLISH, no…
-3
votes
2 answers

How can I print a stored date using locales?

I need to print a stored date (documentDate) in a specific locales format (localeIreland), so far I can only get it to print today's date with cal.getDate() is it possible to get Calendar to print using a stored date value? String documentDate =…
Ninja2k
  • 819
  • 3
  • 9
  • 34
-3
votes
2 answers

DateFormat.parse() giving wrong result

I have played with this for almost 6 hours now and looked at other questions but can't seem to figure out what I'm doing wrong that is giving me these odd results. Here is my code below String dateStr = "20171230"; StringBuilder sb = new…
Mason
  • 1,662
  • 1
  • 9
  • 10
-3
votes
2 answers

javascript how to display a input dates month, day and year in separate lines?

How do I parse a date in javascript to out put a users date input to display in html in seperate lines such as: Month: Day: Year: I am using:

Ed Villa
  • 69
  • 9
-3
votes
2 answers

Convert a Date dd/MM/yyyy to dd-MM-yyyy in java

I'm trying to convert a date in dd-MM-yyyy format from YYYY-MM-dd hh:mm:ss.ms in java using the below code but m unable to get the desired value String dob = (new…
Mavericks
  • 283
  • 1
  • 7
  • 20
-3
votes
4 answers

i want to parse date in my format but is give me exception in android?

i am trying to convert original datetime in to my format but is give me exception my date :2014-01-22 13:24:03 in this format now i want to convert Date.java SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd k:mm:ss"); Date date =…
Mahesh
  • 1,559
  • 6
  • 27
  • 57
-3
votes
2 answers

Java exception handling

Hi I am trying to use the following piece of code i got a parse exception and need to know how to handle DateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy"); Date date1 = (Date)formatter1.parse(startDate); Date date2 =…
user1450954
  • 237
  • 1
  • 3
  • 10
-4
votes
1 answer

Regex for validate string, date format YYYYMMDD without separators + 5 free Digits

I need to use a regex to validate the next rules : •The first 8 characters should be in ‘date’ format of YYYYMMDD without separators •Total expression length should be 13 characters I use internal regular expressions manager Java code example…
-4
votes
2 answers

Formatting date in Java using SimpleDateFormat

I am trying to parse a date into an appropriate format, but I keep getting the error Unparseable date Can anyone tell me what the mistake is? try { System.out.println(new SimpleDateFormat("d-MMM-Y").parse("05-03-2018").toString()); } catch…
-5
votes
5 answers

Java parse date string returns wrong month

I try to parse a date string, but get wrong month, why? new SimpleDateFormat("yyyy-MM-DD", Locale.US).parse("2018-03-08") Why this returns month as Jan? Please check screenshot:
AVEbrahimi
  • 17,993
  • 23
  • 107
  • 210
-5
votes
1 answer

Exception on Date parsing android

I am using a function to take out the difference between a given date and current date. At all the places, that function is working just fine but at one place, it is throwing the unparseable date exception. Below is the function that I use: public…
-7
votes
1 answer

How to convert dd/MM/yyyy string to MM-dd-YYYY DateTime int C#

What is the best way to convert string (dd/MM/yyyy) to date (MM-dd-YYYY) in C#? string date = "15/01/2017"; DateTime date1 = DateTime.Parse(date, new CultureInfo("en-CA")); btnBack.Text = date1.ToString(); I have error String was not recognized as…
M. Rashford
  • 121
  • 1
  • 12
-8
votes
1 answer

How to format the given date "31.12.9999" in the format "yyyy/MM/dd HH:mm:ss"

i have a common doubt for a long while. During date formation if the input date in the format like "2019/05/22 02:00:23" then with the help following line we can format the date, String inputDate = "2019/05/22 02:00:23"; SimpleDateFormat…
Pearl
  • 384
  • 1
  • 8
  • 15
-8
votes
2 answers

Parse complex date with SimpleDateFormat

I have a date in string, provide by webservices: 2013-05-13T10:06:34.023-03:00 How to parse this to Java Date? SimpleDateFormat with yyyy-MM-dd HH:mm doesn't work... I need only date and time (not -3:00). Thanks, Mateus
Mateus
  • 389
  • 3
  • 20
1 2 3
32
33