Questions tagged [datetime-parsing]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
96 views

Date Parse Exception in Android for input Mon, 11 Sep 2023 15:49:32 GMT

fun calculateAge(dateString: String): String { val dateFormat = SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z") dateFormat.timeZone = TimeZone.getTimeZone("GMT") ...
MARSH's user avatar
  • 115
1 vote
2 answers
56 views

DateTimeFormatter with multiple pattern not working

Both of these patterns working fine when tested separately but they are not working together in a single ofPattern { "[]" + "[]"} statement. Please guide what am I missing here ...
Sahib Yar's user avatar
  • 1,020
-1 votes
3 answers
103 views

How to convert Timestamp in CDT Format to MM/DD in Java?

I have a timestamp in cdt format as below "2023-06-05T09:00:01CDT", I want to convert this timestamp into MM/DD format in Java. I have tried below : The expected output was: 6/5 But was ...
BugEater's user avatar
-1 votes
1 answer
136 views

Unable to obtain LocalDateTime from TemporalAccessor: when trying to sort the date in the stream

I want to sort the posts by date("hh:mm:ss"). but I get a mistake. Can you tell me what I did wrong? java.time.format.DateTimeParseException: Text '12:55:36' could not be parsed: Unable to ...
R Zav's user avatar
  • 29
-1 votes
1 answer
222 views

Get period between two times

I have two string time. How can I get a duration of period between theese two time? I try to use DateTimeFormatter, but it doesn't work. val startTime = LocalDate.parse("19:30", ...
Jekis Osipov's user avatar
1 vote
3 answers
191 views

Parse non-UTC date string as UTC Instant, and print it out in another TimeZone

I am using Java 11. I have a datetime string which looks like this "2023-02-17T03:56:50.254" But I know it represents a point in time in UTC time zone. How do I parse this string taking into ...
peter.petrov's user avatar
  • 38.5k
0 votes
1 answer
91 views

Time parsing error in Golang while Un-Marshalling

The JSON Request Body: { "ifr": "b997c96cb360", "ste": "EN", "tye": "random", "description": "...
Aditya Sinha's user avatar
0 votes
0 answers
64 views

Final epoch is 3 days ahead of the actual time given as input [duplicate]

My epoch value is 3 days ahead of the actual time passed as input. I have a date 2023-03-21T04:34:12.234567800Z in which 00Z is the offset, but once I convert it to epoch in java, I am getting an ...
Nagesh R Shanbhag's user avatar
0 votes
1 answer
76 views

MESZ is not recognized in the pattern of DateTimeFormatter of Java

LocalDateTime time = LocalDateTime.parse("27. April 2021 00:03:50 MESZ", DateTimeFormatter.ofPattern("dd. MMMM yyyy HH:mm:ss z")); Trying to parse time string as shown above. 'z' ...
Vishal 's user avatar
1 vote
0 answers
75 views

How to parse non-zero paded datetime string with strptime when leading zero is optional? Thanks

I've been trying to parse a datetime string in a file names with datetime.datetime.strptime(). import datetime datetime.datetime.strptime('2023110912', "%Y%m%d%H%M") datetime.datetime....
Frank Li's user avatar
-1 votes
1 answer
117 views

String timestamp to Date in java

I want to convert a String timestamp "20221225182600Z+0100" to date in java without using simpledateformat I am getting an error Text '20221225182600Z+0100' could not be parsed at index 2 ...
VIMALJITH K's user avatar
0 votes
0 answers
25 views

How Convert arbitrary String to DataTime type

Who could say - how convert this string for example - {YYYY-MM-DD_hh-mm-ss} into DateTime type in .net core? I tried regex but im really not good in it
Anton's user avatar
  • 1
1 vote
2 answers
114 views

how do you convert a date string that contains a monthname to a datetime?

I am sure this ust be simple, but the search engines lead me articals that answer everything but this :-( I have a string "13 February 2023 13:45:40" that I need to convert to a datetime so ...
back_ache's user avatar
  • 382
0 votes
0 answers
94 views

How to set start time with datetime-type input value in JS?

I have a countup app. Here is the thing: https://stackblitz.com/edit/web-platform-mjepwa?file=main.js] I have this code in my function. It sets from when the timer starts counting. past = Date.parse('...
Taimur Nishit's user avatar
-1 votes
1 answer
201 views

Time Conversion in java from SGT to UTC not working for 12:35:42 [duplicate]

Trying to convert Singapore Time to UTc and need the result in OffsetDateTime. The below code works for me for all scenerios except one for 12:35..... for 12:00 noon it is somehow giving wrong results....
Varun Yadav's user avatar
0 votes
0 answers
43 views

DateTimeParseException on specific device [duplicate]

Has anyone encountered DateTimeParseException on specific devices? I've encountered a crash that happens on a Samsung J7, Android 9 whenever this String is parsed 3/30/2023 12:00:00 AM. The parsing ...
Alvin Dizon's user avatar
  • 1,855
-1 votes
1 answer
149 views

Why I am not able to parse 2013-03-10T02:59:59Z from PST in Java using parse method of java.text.SimpleDateFormat?

For certain input values though format and all things are correct, I am getting ParseException from SimpleDateFormat.parse(String input) method. I'm in a scenario where I need to convert time from ...
Risabh Gupta's user avatar
1 vote
1 answer
37 views

ValueError in time-date data

I'm facing issue in matching the format of time date data time data '03-MAY-22 02.42.33.000000000 AM' does not match format '%d-%b-%y %I.%M.%S.%f %p' what should be the correct format for this date-...
Devendra Yadav's user avatar
0 votes
1 answer
164 views

Trying to convert from 2023-01-11 18:27:59UTC-06:00 to 2023-01-12T00:27:59.000Z -- parsing fails

I have string date format like below 2023-01-11 18:27:59UTC-06:00 need to convert to like 2023-01-12T00:27:59.000Z (in UTC zone) I tried the below. I am getting exception Exception in thread "...
user3763183's user avatar
1 vote
1 answer
523 views

How can I format this value in java localdatetime?

Wednesday, 30 Nov 2022 10:30:00 (UTC) 12/08 (Thu), 10:00 GMT Each item was extracted using regex from the data uploaded in this way. With the selected items, we want to construct a localDatetime in ...
sktom2's user avatar
  • 11
0 votes
1 answer
223 views

Problem converting time from String to ZonedDateTime in Android studio [duplicate]

I solved the problem itself, but I wanted to know why this is happening. The problem is this: Initially, a date and time with a time zone in String format ("dd-MM-yyyy HH:mm:ss:SSSS OOOO") ...
Кирилл Протченко's user avatar
-2 votes
1 answer
131 views

Cannot parse '12/16/2022, 1:33 pm' using 'M/d/yyyy, h:mm a' format pattern into a LocalDateTime object

The value 12/16/2022, 1:33 pm looks to match to expected format pattern M/d/yyyy, h:mm a, what is incorrect at index 17? Java unit test: @Test public void testLocalDateTime_shortDateTimePattern() { ...
bobbyrne01's user avatar
  • 6,325
2 votes
2 answers
429 views

C# Parse DateTime using DateTime.TryParseExact() multiple format

I have a string text that i want to parse/convert to DateTime, the text can have a different formats (depending on the user who write it), it can be "dd/MM/yyyy" or it can be "MM/dd/...
Bola Adel Nassif's user avatar
1 vote
0 answers
275 views

Unparseable date exception for the date format 2020-12-31T11:46:18.000+00:00 [duplicate]

How do i parse a date with the format 2020-12-31T11:46:18.000+00:00 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); Date startDate = sdf.parse("2020-12-31T11:...
Amit's user avatar
  • 255
1 vote
1 answer
456 views

Java OffsetDateTime cannot be parsed [closed]

I want to parse the following String into an OffsetDateTime: OffsetDateTime test = OffsetDateTime.parse("2021-12-31T23:00:00.000+00:00"); However, this results in an exception: java.time....
Lars Wigger's user avatar
0 votes
1 answer
133 views

how to handle java.lang.StringIndexOutOfBoundsException: due to invalid format fromapi response

String response = "20221124112443" in this format data should come from API but i don't know but from API some different format response coming so i am getting below error and app crash ...
MARSH's user avatar
  • 115
0 votes
2 answers
348 views

How can I parse and format this string date 2022-11-08 10:28:04.282551-06?

I have this code: public static void main(String[] args) throws ParseException { String fecha = "2022-11-08 10:28:04.282551-06"; SimpleDateFormat simpleDateFormat = ...
JACGV's user avatar
  • 1
0 votes
2 answers
103 views

Parse DateTime with DateTimeFormatter

I need to parse a date that I receive in a String with the following format: "Mon, 07 Nov 2022 21:00:00 +0100" I have to dump the date to an object of type LocalDateTime and I use the ...
Alberto 's user avatar
0 votes
0 answers
59 views

Date string format convert [duplicate]

Date string1: 2022-10-30T04:45:00+00:00 Date string2: Oct 30, 2022 at 04:45 GMT Date string1 and Date string2, i want formate is "yyyy/MM/dd HH:mm:ss"
YYC's user avatar
  • 1
0 votes
0 answers
32 views

DateTimeFormatter doesnt work via command line [duplicate]

today I have a really strange problem. I will try to explain it as best as I can. So the line where it fails is the third one: LocalDateTime.parse( this.text, DateTimeFormatter.ofPattern("...
Daniel Pfeil's user avatar
0 votes
3 answers
553 views

How to convert Sting into instant in Java [duplicate]

How to convert this string into instant: String date = "Fri Sep 30 00:00:00 IST 2022"; Exception: java.time.format.DateTimeParseException: Text 'Fri Sep 30 00:00:00 IST 2022' could not be ...
Aman's user avatar
  • 23
-1 votes
1 answer
73 views

Java: How to convert "Mon Jun 18 11:32:05 BST 2012" to 18 June 2012

I have a value like the following Mon Jun 18 11:32:05 BST 2012 and I want to convert this to 18 June 2012 How to convert this? Below is what i have tried.. public String getRequiredDate(String ...
Ravi's user avatar
  • 25
-1 votes
2 answers
748 views

How to parse date "2022-07-18T08:24:18Z" in android

I have tried these format but none worked. yyyy-MM-dd'T'HH:mm:ss'Z' yyyy-MM-dd'T'HH:mm:ssZ yyyy-MM-dd'T'HH:mm:ssZZ yyyy-MM-dd'T'HH:mm:ss Also tried "ZonedDateTime", but it is not available ...
Akanksha Paul's user avatar
0 votes
1 answer
456 views

Error when parsing string to datetime using datetime.strptime() in ISO 8601 format in Python

I'm trying to parse a string as a datetime, put it as a new timezone (CEST UTC+02) and return it, but I get this error: > ValueError: time data '2022-07-04T03:15:00Z' does not match format '%Y-%m-%...
Deutrys's user avatar
  • 15
0 votes
1 answer
124 views

Is there one function I can call to parse any string into the appropriate JS Temporal type?

I've got a list of ISO 8601-compatible strings, some of which are dates (like '2022-12-25'), some are date-time values (like '2022-12-25T12:00'), and some have time zone info (like '2022-12-25T12:00-...
Justin Grant's user avatar
  • 44.8k
-1 votes
1 answer
112 views

How to parse date and time in android? [duplicate]

I am trying to parse date and time coming from the api. I am getting this kind of response "ArrivalTime":"\/Date(1543469400000)\/" .How to parse this response?
Suraj D's user avatar
  • 11
6 votes
2 answers
872 views

ZonedDateTime format and parsing exception with “z” in format pattern

I have a problem with parsing ZonedDateTime: DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-ddzhh:mm"); ZonedDateTime.parse(s, formatter); This results in an error: java....
FrancMo's user avatar
  • 2,469
0 votes
0 answers
42 views

Java parsing data after including custom year [duplicate]

I am reading date (in variable "last_time") from a website in the format: MM-dd HH:mm, I want to get this date, parse it, which I did in this code. Then I want to know how much time passed, ...
Mariam Baidauri's user avatar
0 votes
0 answers
164 views

How to add time in strptime(), with date as well

I want to convert the date-time string into date-time object. I missing something can anybody tell me what it is I am missing? dummydate.append(datetime.strptime(row[0],"%m-%d-%Y:%H:%M:%SZ"))...
Monk_1o1's user avatar
2 votes
2 answers
723 views

Parsing Instant using OpenCsv

I am trying to parse Instant from a CSV using OpenCsv this way: @CsvDate("yyyy-MM-dd hh:mm:ss") @CsvBindByName(column = "date") private Instant date; I know that OpenCsv is ...
Tom Carmi's user avatar
  • 385
0 votes
1 answer
89 views

How to remove +00.00 from dictionary value c#

I have a Dictionary<string, object> collection. and the dictionary object looks {8/8/2021 1:38:34 PM +00:00} (datetime object) Facing some milliseconds problem because of +00:00. Need to remove +...
Gokul Kumar's user avatar
0 votes
1 answer
97 views

Regex for hours, min and optionally Section with more possible formats

I need to create regex that allows below time values: single digit or double digits and optionally second. All possible combination for single digit of Hour/Minute/Second: hh:mm:ss AM/PM h:m:s AM/PM ...
dsi's user avatar
  • 3,219
0 votes
2 answers
434 views

Remove noise(hours) for parsing time in Y/M/D format

I am parsing the dates of my dataset, but am encountering a lot of ParserError because the hours are often in the wrong format. I've decided to skip the hours and only focus on Years, Months, Days ...
Mischa van ek's user avatar
0 votes
1 answer
197 views

Why can I not deserialize "Wed Mar 09 14:02:57 +0800 2022" with format "EEE MMM dd HH:mm:ss Z yyyy"? [duplicate]

Why can't I use EEE MMM dd HH:mm:ss Z yyyy to deserialize Wed Mar 09 14:02:57 +0800 2022? Is there anything wrong? I am using Jackson and I added this annotation in my entity class @JsonFormat(pattern=...
Dax1's user avatar
  • 11
9 votes
1 answer
1k views

Customize a Locale in Java

In Java the Locale defines things that are related how people want to see things (like currency formats, the name of the months and when a week starts). When parsing the name of a Month (with a ...
Niels Basjes's user avatar
  • 10.5k
0 votes
1 answer
402 views

Flutter rounds DateTime value to 3 decimal places [duplicate]

I'm developing a web app using Flutter front-end and FastApi. I encountered this issue while using DateTime, that its value has a different length in either of the languages (Python & Dart). ...
ASAD HAMEED's user avatar
  • 2,376
-2 votes
2 answers
307 views

What is wrong with this java date formatter?

I'm trying to format the date you see as a String in the below code, to be able to have it as a LocalDateTime object, but I'm getting an exception, I'm following this guide https://mkyong.com/java8/...
BugsForBreakfast's user avatar
1 vote
0 answers
50 views

Parsing a ZonedDateTime around the Daylight saving transition fails [duplicate]

I was testing the edge cases for my code and I ran into an unexpected effect with regards to parsing a ZonedDateTime in Java. This parsing does not behave as I expect it in the Daylight savings ...
Niels Basjes's user avatar
  • 10.5k
3 votes
6 answers
304 views

How to extract 3 numbers from a String

I have an array of strings that contains the following: "1 years, 2 months, 22 days", "1 years, 1 months, 14 days", "4 years, 24 days", "13 years, 21 days", &...
KenobiBastila's user avatar
2 votes
3 answers
319 views

Convert or format string to date

I am struggling with this .. I have an input string - like this: 2021-10-13 11:33:16.000-04 Using Java. I need to get a Date object from it. which formatting pattern can I use ? I try with these ...
Dmitriy Ryabin's user avatar

1
2 3 4 5
9