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

javascript dates with same date format

I am facing an issue in javascript dates . i want to do same date format both previous date and start date Excepted Output previous date after 12AM shows 00:00:00 to 12:00:00 after 12PM shows 00:00:00 to 12:00:00 format previous date 2020-05-10…
adnan khan
  • 101
  • 1
  • 3
  • 7
2
votes
4 answers

javascript date format yyyy-mm-dd HH:MM:ss

I have facing an issue in javascript date format all dates in this format yyyy-mm-dd HH:MM:ss My Code: var currentdate = new Date(); var prevdate = new Date(); var firstdate = new Date(); prevdate.setTime(currentdate.getTime() - (30 * 60 *…
adnan khan
  • 101
  • 1
  • 3
  • 7
2
votes
1 answer

javascript compare or match two dates with same format

I have facing an issue in Javascript dates. i want to compare or match two dates and show its another array. My Code: var ts_hms = new Date().toISOString(). replace(/T/, ' '). // replace T with a space replace(/\..+/, ''); // delete the…
MHasan
  • 69
  • 1
  • 8
2
votes
2 answers

How to properly convert string to std::chrono::system_clock::time_point?

I have followed some good answers to similar questions like this one. Yet my code seems to give output one hour later after converting string to time_point and back to string. The code that gives the wrong answer: #include #include…
Spideyyyy
  • 123
  • 4
2
votes
1 answer

Is there a way in Java to convert strings to dates that are either MMddyyyy or Mddyyyy?

I've been trying to convert strings to dates. Some of them show up like this: 1011970 (as in January 1, 1970) and some show up like this: 10011970 (as in October 1, 1970). The fact that the month is at the beginning has created a big problem for me.…
2
votes
2 answers

Converting a string with Arabic characters to a date

I'm trying to verify that a list of items are sorted according their date desc through Java and appium. I managed to extract the dates from the screen as a String, but I'm facing a difficulty in converting these strings into dates because the string…
2
votes
1 answer

Overwrite DateTimeFormatter localized date style parsing strategy for century

I need to parse the date string dynamically based on the locale and format style. For example, I have an Albanian locale which has pattern yy-MM-dd I have following code which resolves this pattern basing on the current locale and format…
cudouny
  • 124
  • 7
2
votes
1 answer

Correct Date format to use for GsonBuilder Date Format

My client sends me a date in "2019-11-22T16:16:31.0065786+00:00" format. I am getting the following error: java.text.ParseException: Unparseable date: "2019-11-22T16:16:31.0065786+00:00" The date format that I am using is: new…
Abdul
  • 21
  • 3
2
votes
1 answer

Parsing of weekdays not working for locale german

I'm trying to use java.time.format.DateTimeFormatter to parse time strings but ran into a problem parsing german short day of week names. Given the following program import java.time.DayOfWeek; import java.time.format.DateTimeFormatter; import…
robertkrahn
  • 132
  • 2
  • 6
2
votes
1 answer

How to handle "dparser" exception which stops the program in Python?

I have the following code which should not stop my program I guess: import dateutil.parser as dparser t = "79999999999" try: dp = dparser.parse(t, fuzzy=True) except ValueError as ve: print('ValueError: {}'.format(ve)) …
Peter.k
  • 1,475
  • 23
  • 40
2
votes
1 answer

java.text.ParseException: Unparseable date: "28.дек.2018"

Possible Java 8 bug while parsing dates using pattern with dot after short month (like dd MMM.yyyy) for several months (not all of them) in Russian locale: Exception in thread "main" java.text.ParseException: Unparseable date: "28 дек.2018" at…
2
votes
1 answer

java parse date with picosecond

I have a string date with picoseconds (between 9 to 12 digits after the period), and when I try to parse the date with the DateTimeFormatter : DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSSSSSSS"); it throws…
2
votes
1 answer

DateTime.ParseExact for "dMMyyHHmmss" format not working (c#)

I have dates comming in a log file with the following format: "dMMyyHHmmss". As I want to throw an exception if the format found is not exactly that one, I'm using DateTime.ParseExact. The thing is that I'm getting a FormatException with the…
joacoleza
  • 775
  • 1
  • 9
  • 26
2
votes
1 answer

Python - Date parser that could get all the dates from a specific string input

Currently doing a task that has given to me which is partly related to machine learning. The task is to parse a string input from the user into a date, given that I could have 2 parameter for the function: date_from and date_to; something like the…
JJ186021
  • 31
  • 1
  • 10
2
votes
4 answers

Javascript date parsing - why?

I have an issue with date parsing in javascript. I could have dates in different formats so I need to have universal parser. I use Date.parse(), but can someone explain me why that's happen: Date.parse("1/07/2018"); 1515279600000 but…
zleek
  • 201
  • 4
  • 16