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
3 answers

How to disable zero-padding leniency in SimpleDateFormat

I'm using SimpleDateFormat with pattern "MM" and try to parse "0012". Even with leniency disabled the formatter will successfully parse this to december. I'd like it to throw an exception, this is no 2-digit-month. Does anyone know how to achieve…
Roland
  • 18,114
  • 12
  • 62
  • 93
3
votes
2 answers

Convert "mm/yy" to "yyyy-mm-dd" in java

I need to convert "11/17" string date (November 2017) to "2017-11-01" (November 1, 2017). What is the best way to achieve this in Java? I tried: String dayMonthYear = "11/17"; dayMonthYear = "01/" + dayMonthYear; DateTimeFormatter formatter =…
Bilberryfm
  • 507
  • 2
  • 11
  • 28
3
votes
2 answers

How to parse date with only month and year with SimpleDateFormat

I am working with expiration date of card. I have a API where I will get expiration date in "yyMM" format as "String". Here I am trying to use SimpleDateFormat with TimeZone.getTimeZone("UTC") So my code is like String a=…
user2367130
  • 125
  • 1
  • 2
  • 10
3
votes
3 answers

Jackson to deserialize Joda LocalDate from ISO DateTime

I am using Angular date picker to send my MVC controller a date, using a Javascript Date object which is an ISO date/time. On deserializing java.util.Date it works like a charm and Hibernate will care about cutting that Datetime to a plain Date when…
usr-local-ΕΨΗΕΛΩΝ
  • 26,101
  • 30
  • 154
  • 305
3
votes
1 answer

d3.js v4 timeParse() not working?

I saw a lot of examples doing the same, but the d3.timeParse() function just doesn't work as expected in my code and returns null. let parseDate = d3.timeParse("%Y-%m-%d"); let now = new Date(); console.log(now)//returns js date object let…
Getter Jetter
  • 2,033
  • 1
  • 16
  • 37
3
votes
4 answers

Unexpected exception while parsing date

I am trying to parse the date according to the following code but getting exception. Below is the code - public class DateTest { public static void main(String args []) { String start = "23-Jan-2017"; DateFormat…
3
votes
3 answers

How do I parse a date string in an unknown format on iphone?

How can I parse a string that represents a date and/or time using iPhone SDK if I do not know the format? I am building an application that will allow a range of possible dates and times to be used, and I don't want it to fail because the format…
Dan Berlin
  • 45
  • 5
3
votes
1 answer

Create a parse function for different date formats in Python

I want to create a parse function with lambda able to recognize two different formats "2014-01-06 15:23:00" and "2014-01-06" The idea is to use this function to create a pandas dataframe but in some of the values the hour is missing This is my…
gis20
  • 1,024
  • 2
  • 15
  • 33
3
votes
2 answers

How to Sum N values in time format (hh:mm:ss)?

I used date_parse function and added some time values. print_r(date_parse("23:00:00")); $parsed = date_parse($totdh); $seconds = $parsed['hour'] * 3600 + $parsed['minute'] * 60 + $parsed['second']; $TotDownMinutes = $seconds / 60; i had problem…
J Ramesh Fernandez
  • 309
  • 1
  • 8
  • 22
3
votes
4 answers

Convert timestamp string with epochal time and timezone into NSDate

I have a String in following format "/Date(573465600000-0800)/" How do I convert this to regular NSDate object?
Sam Shaikh
  • 1,596
  • 6
  • 29
  • 53
3
votes
3 answers

php date_parse("Feb 2010") gives day == 1

There is what I would call a bug in date_parse when there is no day. $d = date_parse("Feb 2010") will give $d["day"] == 1. See the comment on this on the date_parse manual page. Any nice workaround for this problem? :-) UPDATE The date comes from…
Leo
  • 4,136
  • 6
  • 48
  • 72
3
votes
2 answers

Parsing of Ordered Timestamps in Local Time (to UTC) While Observing Daylight Saving Time

I have CSV data files with timestamped records that are in local time. Unfortunately the data files cover the period where daylight saving time changes (Nov 3rd 2013) so the time component of the timestamps for the records go: 12:45, 1:00, 1:15,…
CuppM
  • 1,668
  • 4
  • 19
  • 30
3
votes
10 answers

How to parse "dd-MM" date format to get current year?"

I have to parse "17-Jun" format date using Java.But the problem is when I try to parse "dd-MM" format using SimpleDateFormat it is returning as "Wed Jun 17 00:00:00 IST 1970".Is it possible to get current(2014) year instead of 1970. My…
user492888
  • 207
  • 3
  • 17
3
votes
1 answer

finding dates and their position within a string using stanford nlp

I need to find the dates within a string and their positions. Consider the example string "The interesting date is 4 days from today and it is 20th july of this year, another date is 18th Feb 1997" I need the output (Assuming today is…
Shiva
  • 95
  • 7
3
votes
3 answers

Why don't I get the year right using SimpleDateFormat in java?

I trying to parse a data in a MySql Format, I ran across SimpleDateFormat. I can get the proper day and month, but I got a strange result for the year : date = 2009-06-22; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date d =…
Bite code
  • 578,959
  • 113
  • 301
  • 329