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

GWT client - server SimpleDateFormat changes timezone to default

I'm using GWT RPC to send a string containing a date from the client to the server (it has to be this way, because it's on a request header). On the server side I parse that string with SimpleDateFormat and make the logic I want. I'm setting both…
Nuno Gonçalves
  • 6,202
  • 7
  • 46
  • 66
2
votes
1 answer

Convert a formatted date string to a date value in XPath

How can I convert a date contained in a string into a date value with XPath? I got the string by formatting a date value with fn:format-date, and now I want the date value from the formatted string. Thank you,
trin86
  • 157
  • 2
  • 2
  • 8
2
votes
3 answers

Wonky dating in Java

The following Java code just parses a date (with time portion) 2009-01-28-09:11:12 using SimpleDateFormat. Let's have look at it. final public class Main { public static void main(String[] args) { try { …
Lion
  • 18,729
  • 22
  • 80
  • 110
2
votes
2 answers

Different Date.parse results for 2011-11-15 and 2011/11/15

Why Date.parse("2011-11-15") considers current time zone in Web browser, and Date.parse("2011/11/15") does not? Why the results are different?
KIR
  • 5,614
  • 1
  • 31
  • 23
2
votes
2 answers

Date format issue in Android 12

Following is the code to parse date. I have used 'joda-time:joda-time:2.9.9' lib for formatter. String date = "Sun Sep 04 17:29:52 +0000 2022"; DateTimeFormatter dateFormat = DateTimeFormat.forPattern("EEE MMM dd HH:mm:ss Z…
2
votes
0 answers

Know which parts a day contains

The dateparser library set missing parts of a date to today's values. Example: >>> import dateparser >>> dateparser.parse("2015") datetime.datetime(2015, 2, 14, 0, 0) How to know which parts a date really contains? (and thus which parts were set to…
robertspierre
  • 3,218
  • 2
  • 31
  • 46
2
votes
3 answers

How can I use Java's SimpleDateFormat to parse a timezone given as "GMT+0100 (BST)"?

I have a date that's in the form of: Wed Aug 17 2011 09:57:09 GMT+0100 (BST) and have a filter that takes a time in a certain format. The problem seems to be the time zone on the end, none of the format strings I'm putting in the filter seem to…
user898465
  • 944
  • 1
  • 12
  • 23
2
votes
1 answer

Parsing dates from OCRed files using dateparser library

I want to extract dates from OCR images using the dateparser lib. import dateparser data = [] listOfPages = glob.glob(r"C:/Users/name/folder/test/*.tif") for entry in listOfPages: text1 = pytesseract.image_to_string( …
id345678
  • 97
  • 1
  • 3
  • 21
2
votes
2 answers

Android date format with Month

How to get the Android date format "7/25/2021" to July/25/2021 Here is the portion of the code mDisplayDate is the Textview mDisplayDate.setOnClickListener(view -> { Calendar cal = Calendar.getInstance(); int year = cal.get(Calendar.YEAR); …
speedflow
  • 75
  • 6
2
votes
2 answers

Parse lowercase short weekday to Java 8's time DayOfWeek

I have a string, e.g. "mon" or "tue" or "sun". I want to parse it as a DayOfWeek (or null if not successful). I'm using Kotlin, but i guess the Java folks will also understand what i would like to do: private fun String.parseToDayOfWeek(pattern:…
m.reiter
  • 1,796
  • 2
  • 11
  • 31
2
votes
1 answer

How to deserialize date in format "yyyy-mm-dd hh:mm:ss"?

I am getting a date in a format like this "2021-03-26 22:02:53" from the API which is not ISO format, and I created a custom serializer for it but I am getting an error. I also do not want to use ISO format, and I want to send back the date as…
2
votes
1 answer

format a full date with timezone and day of the week name string

I'm trying to create a date object from the string 01:03:55.065 GMT Tue Mar 16 2021 in NodeJS javascript with date-fns v2.21.3 but I wouldn't mind using regular javascript Date instead. this is my code: const df = require('date-fns'); const…
ufk
  • 30,912
  • 70
  • 235
  • 386
2
votes
2 answers

What is the correct behavior of std::get_time() for "short" input

I'm trying to understand what should be the correct behavior of C++11 std::get_time() when the input data is "shorter" than expected by the format string. For example, what the following program should print: #include #include…
2
votes
1 answer

How to generate JWT exp claim with java-time?

Most examples for JWT token use clj-time which is now deprecated in favor of native java.time. I'm trying to use java-time along with buddy to sign/verify tokens but I'm stuck trying to pass the exp claim to my token. Here's an example of what I…
stigma
  • 338
  • 2
  • 12
2
votes
1 answer

chrono parse including timezone

I'm using @howard-hinnant 's date library (now part of C++20) to parse a date string that includes a timezone abbreviation. The parse takes place without errors, but it appears that the timezone is ignored. For example: istringstream…
logidelic
  • 1,525
  • 15
  • 42