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
10
votes
1 answer

How can I make a DateTimeFormatter that accepts trailing junk?

I'm retrofitting old some SimpleDateFormat code to use the new Java 8 DateTimeFormatter. SimpleDateFormat, and thus the old code, accepts strings with stuff in them after the date like "20130311nonsense". The DateTimeFormat I created throws a…
Samuel Edwin Ward
  • 6,526
  • 3
  • 34
  • 62
10
votes
4 answers

Inconsistent date parsing using SimpleDateFormat

I'm really scratching my head on this one. I've been using SimpleDateFormats with no troubles for a while, but now, using a SimpleDateFormat to parse dates is (only sometimes) just plain wrong. Specifically: SimpleDateFormat sdf = new…
Matt Ball
  • 354,903
  • 100
  • 647
  • 710
9
votes
3 answers

Convert UTC to local time with NSDateFormatter

I am getting the following string from a server in my iOS app: 20140621-061250 How can I convert it to the local time? How can I define my date formatter? Is this correct? dateFormatter.dateFormat = @"YYYYMMd-HHmmss";
cateof
  • 6,608
  • 25
  • 79
  • 153
9
votes
7 answers

How to use JSON.parse reviver parameter to parse date string

My JSON string contains a date field that returns such a value: "2009-04-04T22:55:16.0000000-04:00" I am particularly interested in parsing only the date compartment not the time. I tried using a reviver function, but interestingly the reviver…
Aleyna
  • 1,857
  • 4
  • 20
  • 27
8
votes
2 answers

How to convert string to datetime?

I have the following string: '2017-08-15T13:34:35Z' How to convert this string to object that I can call .isoformat()? someobject = convert('2017-08-15T13:34:35Z') someobject.isoformat() How to implement convert()?
user6611764
8
votes
1 answer

Natural Language Date Parser for JS that supports arbitrary text surrounding e.g. - "Follow up next week"

PROBLEM Libraries like sugar.js can convert natural language date strings such as: "next week" but cannot handle strings such as: "Blah blah blah... Follow up next week" In my application, I need to process a paragraph of notes and detect action…
blak3r
  • 16,066
  • 16
  • 78
  • 98
8
votes
4 answers

Do you know an awesome Python library for manipulating dates?

I search an awesome Python library date like Moment.js. Do you know some? I want especially a library that can do conversions like this: 09/25/2012 00:00 - 09/25/2012 13:00 to 09/25/2012 00:00 - 13:00.
tsil
  • 2,069
  • 7
  • 29
  • 43
8
votes
3 answers

Fuzzy date parsing with Java

Are there any libraries for Java that allow you to interpret dates like "Yesterday", "Next Monday", ...
carrier
  • 32,209
  • 23
  • 76
  • 99
7
votes
1 answer

Pandas read_excel doesn't parse dates correctly - returns a constant date instead

I've read a .xlsb file and parsed date columns using a code below: dateparser = lambda x: pd.to_datetime(x) data = pd.read_excel(r"test.xlsb", engine="pyxlsb", parse_dates=["start_date","end_date"], …
Roberto
  • 649
  • 1
  • 8
  • 22
7
votes
4 answers

Convert Date String to another Date string with different format

I need to convert an string date with format yyyyMMdd to a date string with format MM/dd/yyyy. Which is the best to do it? I'm doing this: DateTime.ParseExact(dateString, "yyyyMMdd", CultureInfo.InvariantCulture).ToString("MM/dd/yyyy") But I'm not…
Müsli
  • 1,744
  • 7
  • 27
  • 50
7
votes
2 answers

JavaScript AM/PM time comparison

Suppose I have 2 datetime variables: var fromdt = "2013/05/29 12:30 PM"; var todt = "2013/05/29 01:30 AM"; I want to compare these 2 datetimes. How can I get Javascript to recognize whether the time is AM or PM? I think Javascript will compare the…
Dylan
  • 137
  • 1
  • 2
  • 10
7
votes
1 answer

java.text.ParseException: Unparseable date (German, Ukrainian)

I need to parse a date into 11 different languages. So far, only two are giving me trouble: German and Ukrainian. package com.example; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import…
DrewShirts
  • 147
  • 1
  • 6
  • 19
7
votes
7 answers

Automatic Date/Time parser without specifying format

I am searching for a java library that can parse a string into a POJO without specifying the format. I have researched POjava. Is there anyother library which does similar thing? DateTime dateTime = DateTimeParser.parse("21/02/13"); //If unclear…
saravanan07
  • 365
  • 2
  • 4
  • 14
6
votes
2 answers

How to sort array of objects where keys are dates

I have searched for this question and no existing answer seems to apply. Consider the following: [ { 'August 17th 2016': [75] }, // 75 is the length of the array which contains up to 75 objects ... { 'August 1st 2016': [5] }, { 'August 28th…
TheWebs
  • 12,470
  • 30
  • 107
  • 211
6
votes
2 answers

Parsing a Twitter date with Joda Time

Twitter gives me a date such as "Wed, 27 Mar 2013 15:12:14 +0000". I'm trying to parse it with: DateTimeFormat.forPattern("EEE, dd MMM yyyy HH:mm:ss ZZZZZ").withLocale(Locale.ENGLISH); But it fails: Invalid format: "Wed, 03 Apr 2013 10:35:35 +0000"…
Bart van Heukelom
  • 43,244
  • 59
  • 186
  • 301
1 2
3
32 33