459 questions
0
votes
1
answer
271
views
could not be parsed: Unable to obtain OffsetDateTime from TemporalAccessor
I have this java code:
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import java.util.Date;
DateTimeFormatter DATE_TIME_FORMATTER
= DateTimeFormat....
2
votes
2
answers
103
views
DateTimeParseException when parsing 01-FEB-25 12.00.00.000000 AM UTC, where is the issue?
I have the following Java (version 8) code that parses a date time string that looks like '01-FEB-25 12.00.00.000000 AM UTC'. Expected result is a ZonedDateTime of 2025-02-01T00:00Z[UTC]. But I keep ...
3
votes
3
answers
153
views
Android SimpleDateFormatter Parse Exception
I have some old Java code that attempts to parse a string using SimpleDateFormat. It is frequently throwing a ParseException:
Non-fatal Exception: java.text.ParseException: Unparseable date:
"06:...
5
votes
1
answer
508
views
Does Java's DateTimeFormatter allow lenient parsing for fractional seconds?
I am currently working with Java's DateTimeFormatter to parse ISO 8601 formatted timestamps, particularly those containing fractional seconds. While experimenting with different timestamp formats, I ...
1
vote
2
answers
360
views
Parse "12:00 a.m." as TimeOnly [duplicate]
I'm struggling with parsing strings ongoing in the "12:00 a.m." format.
I tried TimeOnly.TryParse("12:00 a.m.", CultureInfo.InvariantCulture, out var result), but it doesn't work.
...
0
votes
2
answers
425
views
Java ZonedDateTime.parse not working as expected
I am using Java 17. I am trying to parse different strings as ZonedDateTime but when I try to convert it to an Instant, the output is not as expected. For eg:
String first = "2020-01-...
0
votes
1
answer
269
views
Is there any standard way of parsing RFC3339 compliant dateTime instead of using patterns in java?
Is there any standard way of parsing RFC3339 compliant dateTime instead of using patterns in java ?
It seems there isn't one. I tried finding solution over the internet but most of them were using ...
2
votes
1
answer
721
views
I got the error "java.text.ParseException: Unparseable date: "1/10/24 7:00 PM"" when trying to parse
I have a date string as "1/10/24 7:00 PM" (10th Jan.2024). How to parse it using SimpleDateFormat?
String date_time = "1/10/24 7:00 PM";
Instant answer;
try {
answer = Instant....
1
vote
3
answers
821
views
Parse string date to millis in kotlin
I am using SDF to parse a string date to millis with below code
private fun dateToMilliseconds(dateValue: String): Long? {
val sdf = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS")
val date: ...
3
votes
1
answer
330
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")
...
1
vote
2
answers
232
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
...
-1
votes
3
answers
195
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 ...
-1
votes
1
answer
2k
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 ...
0
votes
1
answer
1k
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", ...
1
vote
3
answers
2k
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 ...
0
votes
0
answers
145
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 ...
0
votes
1
answer
234
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' ...
1
vote
0
answers
126
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....
-1
votes
1
answer
183
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
...
0
votes
0
answers
29
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
1
vote
2
answers
614
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 ...
0
votes
0
answers
144
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('...
-1
votes
1
answer
616
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....
0
votes
0
answers
47
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 ...
-1
votes
1
answer
195
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 ...
1
vote
1
answer
42
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-...
0
votes
1
answer
301
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 "...
1
vote
1
answer
1k
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 ...
0
votes
1
answer
387
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") ...
-2
votes
1
answer
191
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() {
...
3
votes
2
answers
2k
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/...
1
vote
0
answers
357
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:...
1
vote
1
answer
1k
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....
0
votes
1
answer
324
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 ...
0
votes
2
answers
588
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 = ...
0
votes
2
answers
578
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 ...
0
votes
0
answers
63
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"
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("...
0
votes
3
answers
833
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 ...
-1
votes
1
answer
114
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 ...
-1
votes
2
answers
1k
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 ...
0
votes
1
answer
636
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-%...
0
votes
1
answer
237
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-...
-1
votes
1
answer
157
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?
6
votes
2
answers
2k
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....
0
votes
0
answers
44
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, ...
0
votes
0
answers
203
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"))...
2
votes
2
answers
2k
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 ...
0
votes
1
answer
103
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 +...
0
votes
1
answer
411
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
...