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
6
votes
2 answers

Javascript Date.parse method not working correctly

I am using a method to check if a date is valid or not in my application myApp.isValidDate = function(date) { var timestamp; timestamp = Date.parse(date); if (isNaN(timestamp) === false) { return true; } return false; }; It works…
Nadeem Khedr
  • 5,273
  • 3
  • 30
  • 37
6
votes
3 answers

Smart date interpretation

I can't remember which application I was using, but I do recall it having really neat date parsing/interpretation. For example, you could type in 'two days ago' or 'tomorrow' and it would understand. Any libraries to suggest? Bonus points if usable…
carrier
  • 32,209
  • 23
  • 76
  • 99
5
votes
2 answers

Is there a Spring Boot flag to disable lenient Jackson parsing of LocalDate values with times?

Spring Boot defaults allow both dates and datetime values in LocalDate. E.g. for following DTO: public class Person { private LocalDate birthDate; //getter & setters } Both of the following are acceptable: { "birthDate" : "2021-07-24" } { …
SGB
  • 2,118
  • 6
  • 28
  • 35
5
votes
2 answers

Native method to inverse Date.toLocaleString convertion in JavaScript?

We have date converted to locale string. For example: x = (new Date()).toLocaleString() and x has value "20.05.2018, 10:21:37" How to process this string to Date object. I was tried new Date(x) Invalid Date and Date.parse(x) NaN It is possible…
Daniel
  • 7,684
  • 7
  • 52
  • 76
5
votes
5 answers

Best way to parse dates in Northern European format (first DMY, then YMD) using Python

I am looking for a way to parse dates of unknown formats using the following "meta-formats" in order of preference: day-month-year (DMY) year-month-day (YMD) potentially other formats (but thats not important) This is the actual meta-formats…
elgehelge
  • 2,014
  • 1
  • 19
  • 24
5
votes
1 answer

Parsing with Java 8 DateTimeFormatter and Spanish month names

With the 'old', pre-Java 8 SimpleDateFormat I can do: new java.text.SimpleDateFormat("MMM yyyy", new java.util.Locale("es", "ES")).parse("Mayo 2017") to get the Date object of a date with Spanish month names. How can I achieve the same with Java 8…
Kris
  • 4,595
  • 7
  • 32
  • 50
5
votes
1 answer

Java date format for 00 days/months

I have a date as String, but sometimes it doesn't have valid day or month (the values are zeros, 00). Example: String value = "03082017"; Then I do: String day = value.substring(0,2); String month = value.substring(2,4); String year =…
Patrik
  • 63
  • 7
5
votes
3 answers

How to differentiate when "second field" is missing in LocalDateTime

I am given LocalDateTime object created from String. I want to check whether that original string has "seconds" parameter or not. My two inputs are: String a = "2016-06-22T10:01"; //not given String b = "2016-06-22T10:01:00"; //not…
Pratik Kumar
  • 81
  • 10
5
votes
2 answers

C++ parsing YYMMDD ISO 8601 date string with std::get_time gives unexpected result?

I'm trying to parse a date formatted as YYMMDD. As a test, I've tried the following code: #include #include #include #include int main(){ std::tm t = {}; std::istringstream ss("191203"); ss >>…
Valeriop84
  • 125
  • 1
  • 6
5
votes
3 answers

How to parse a date string including Μαϊ (greek May) in Java

I cannot parse strings that contain dates, that include the short version of the month May in Greek (Μαϊ, which is in short for Μαΐου - note on the ϊ-ΐ difference). For example: 25 Μαϊ 1989 24 Μαΐ 1967 won't parse, if I use the following…
Alex Styl
  • 3,982
  • 2
  • 28
  • 47
5
votes
2 answers

Lua Date Manipulation Loop

I'm attempting to run a batch script with two date values that I would like to adjust and then have the script run again. I would like to reference a lua script that will adjust those date values for me. I'm using lua simply because most of the…
MRCLE
  • 75
  • 4
5
votes
2 answers

How can I determine which date format I've received?

In dealing with a wide variety of JSON data being sent from various clients date format standardization is a real problem. I might get any of these: 2013-10-05 2-6-13 Mon, Jul 13 2013 Sometimes there's hours, minutes and seconds as well as time…
DC2
  • 119
  • 8
5
votes
3 answers

Parsing String to Date without using SimpleDateFormat?

I am developing a spring application and in one of my controller i have following lines to parse from string to date and format the parsed date to required format. But again i need to parse back formatted string into date without using any…
Kishan_KP
  • 4,488
  • 6
  • 27
  • 46
5
votes
1 answer

Parse a Python datetime string in Javascript

I need to parse a Python-generated datetime string into a Javascript Date object. I went the simplest route: In Python: dstring = str(mydate) example dstring = '2012-05-16 19:20:35.243710-04:00' In Javascript (with datejs library): d = new…
Yarin
  • 173,523
  • 149
  • 402
  • 512
4
votes
2 answers

Why I can't parse this date format yyyy-MM-dd'T'HH:mm:ss.SSSZ?

I'm trying to parse a string date to a date . My string date is : 2021-12-16T11:00:00.000Z. I have the follwing code to parse it to a date object: val stringDate = "2021-12-16T16:42:00.000Z" val sdf =…
Mario Muresean
  • 233
  • 1
  • 5
  • 16