Questions tagged [datetime-parsing]
423 questions
4
votes
2 answers
Parsing MIME dates in mail headers (C# but not language related)
I'm working on a small local c# app that processes emails. I'm using S22/Imap which downloads and separates headers. When I try to get the Date of the email it returns me the string version, as in MIME headers.
For most of them the DateTime.TryParse…

Poc
- 109
- 10
4
votes
3 answers
Convert specific string to dateTime in dataTable Row
I am trying to convert a specific String to a DateTime which is contained in a DataTable. But for some reason not quite working. I have tried a few combinations. The thing is that the string actually contains " " surrounding the date.
So cell in…

user2091936
- 546
- 2
- 7
- 28
4
votes
1 answer
ISO emacs/elisp to determines dates corresponding to first/last days of a week, e.g. ISO 8601 2013-WW47
I like creating headings that look like
** WW47 (Monday November 18 - Sunday November 24, 2013)
I know how to use format-time-string, etc., in emacs/elisp to determine various definitions of the week-number (%U, %V, %W).
Q: how can I go backwards?…

Krazy Glew
- 7,210
- 2
- 49
- 62
4
votes
1 answer
How do I set a joda LocalDateTime object to a specified time with current and local daylight savings and time zone information in java
I'm trying to create a java.sql.Time object to query time types in an SQL database, but I'm using joda to parse the string that I receive.
I've tried a few different approaches. This is my most recent.
protected Time startTime = null;
protected…

Plant_Face
- 41
- 1
- 3
3
votes
6 answers
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",
"9 months, 1 day";
I need to extract the amount of years,months, days of each item in the…

KenobiBastila
- 539
- 4
- 16
- 52
3
votes
1 answer
Timezone BST has wrong offset
Cannot understand why BST (UTC Offset: UTC +1) got offset +11 in following code. I would expect +1.
final String lastUpdated = "Mon Sep 27 18:29:00 BST 2021";
final DateTimeFormatter LAST_UPDATED_FORMATTER = DateTimeFormatter.ofPattern("EEE MMM dd…

alibaab
- 35
- 3
3
votes
2 answers
Problem with parse a LocalDateTime using java 8
I have this code, it's a simple string that I want to parse it to a LocalDateTime
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
public class DateClass…

Alberto D
- 85
- 2
- 5
3
votes
1 answer
Single class to parse any Date Format in Java
I have been parsing dates in the below formats. I maintain an array of these formats and parse every date string in all these formats.
The code I used was -
SimpleDateFormat simpleDateFormat = new…

Forever NewUser
- 81
- 5
3
votes
3 answers
How to get delimiter from a date string?
24.03.2018 02:34:22 how can I get the delimiter ('.') from a that kind of date string? Format can be different and delimiter can be these '.','-','/' also. Is there a way to do it with Java's date format classes?

Joseph K.
- 784
- 1
- 9
- 19
3
votes
1 answer
Converting date format: conversion error in Java?
I am trying to convert this date to a different format. unfortuantely havnt been successful parsing the date and retaining all the information correctly.
06-Dec-2017 07:14:56.656PM
to
2017-12-06 19:14:56.656
If I try to parse the input…

Vamsi Mohan Jayanti
- 666
- 4
- 8
3
votes
4 answers
Convert datetime to ISO format
I have a date in format dd.MM.yyyy HH:mm:ss and I need to convert it to ISO format, but it's not working correctly.
Here is my code:
let date = '12.01.2016 0:00:00'; //12 January 2016
let parsedDate = moment(date, 'dd.MM.yyyy…

bluray
- 1,875
- 5
- 36
- 68
3
votes
1 answer
Receiving same ZonedDateTime for different time strings
I'm using the below function to convert a microsecond format time string to ZoneDateTime so I can do comparisons later.
public static ZonedDateTime createTimeFromString(String inputTime) {
ZonedDateTime time;
try {
…

Pasan W.
- 674
- 2
- 10
- 23
3
votes
1 answer
Parse date of csv with multiple date formats
I have a csv file which has dates in multiple formats like this:
Date X1 X2
12/6/2017 23:00 928.88 3.19
12/6/2017 23:20 928.86 3.37
12/6/2017 23:40 930.26 3.38
13-06-17 0:00 930.37 3.41
13-06-17 0:20 930.39 3.49
13-06-17…

Dheeraj
- 1,102
- 3
- 14
- 29
3
votes
2 answers
Parsing a string into a ZonedDateTime with a DateTimeFormatter
I'm trying to parse this String into a ZonedDateTime:
"Mon 14 Aug 2017 02:00 AM CEST"
Here my last try:
System.out.println("Test ZonedDateTime: " + ZonedDateTime.parse(
"Mon 14 Aug 2017 02:00 AM CEST",
…

Anonymuf
- 59
- 1
- 6
3
votes
3 answers
String of date to OffsetDateTime
I am converting string of date/datetime to OffsetDateTime and I have datetime format which may have one of these values
yyyy-MM-dd, yyyy/MM/dd
Sometimes with and without time and I need to convert this into OffsetDateTime.
I have tried below…

wazza
- 770
- 5
- 17
- 42