Questions tagged [datetime-parsing]
423 questions
2
votes
4 answers
Convert Date Value to Specific Format in C#
How to convert any date format to a specified format in C#.
For example:
If Date Format is
14.11.2011 or 14/11/2011
Looking for a conversion function which converts into
yyyy-MM-dd format like 2011-11-14

Suave Nti
- 3,721
- 11
- 54
- 78
2
votes
4 answers
Date format for conversion in c#
is there anyone there who can tell me what type of a date format is this '1110620'? And how can I convert this to a 'yyyy-MM-dd' format. Any help is highly appreciated. Thanks!

KG Sosa
- 21,565
- 6
- 26
- 27
2
votes
2 answers
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/yyyy".
I am using DateTime.TryParseExact(string, formats[],…

Bola Adel Nassif
- 66
- 7
2
votes
2 answers
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 supposed to support java.time.
But when trying to use it I am getting the…

Tom Carmi
- 385
- 1
- 5
- 18
2
votes
3 answers
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
SimpleDateFormat inFormatter = new SimpleDateFormat…

Dmitriy Ryabin
- 363
- 3
- 16
2
votes
2 answers
DateTimeFormatterBuilder with am/pm
I'm trying to build a date time format that accepts AM and PM stamps. For example, whenever the LocalTime.parse("12:00 am") in java is called, with the default format, an exception is thrown. So I'm adding my own format like this
String time = "2:00…

Resident Zero9999
- 85
- 6
2
votes
3 answers
How to change dynamically date format
I have a problem with time format.Some time I have values in hh:mm:ss and some times in mm:ss format.
My code looks like:
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String time = "01:48:00"
Date remainedTimeDate = sdf.parse(time);
It…

Kamil
- 77
- 6
2
votes
2 answers
how can I change only year in date String?
I have java date string.
How can I change its year without changing the month and date.
e.g.
parts1[1]= 2020-1-2;
parts1[2]= 13:48:21;
CreatedDate = parts1[1]+" "+parts1[2];
System.out.println(CreatedDate);
I want to change it to
parts1[1]= …

Kumar
- 23
- 3
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
2
votes
2 answers
Failed String Parsing to LocalDateTime using DateTimeFormatter
I am trying to parse a simple string [08/May/2020:09:14:05 +0000] to LocalDateTime using DateTimeFormatter and LocalDateTime but it seems that it does not work for some reasons. I have tried different changes to the format like DD, hh, X, x, or Z…

Ihsan Haikal
- 1,085
- 4
- 16
- 42
2
votes
2 answers
Trying to convert array of strings to date
I'm running into a weird issue where I'm trying to parse an array of the following strings, which have been given the variable…

bsander
- 59
- 1
- 5
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
In Java how do I convert from seconds since epoch to milliseconds since January 1, 1970, 00:00:00 GMT
In short:
I have a time that is in epoch and I want to make it time since January 1, 1970, 00:00:00 GMT as java.util.Date would expect to be given.
This code helps demonstrate my issue:
import java.util.Date;
import java.util.Locale;
import…

Luke
- 884
- 8
- 21
2
votes
3 answers
How to format an ISO-8601 string in Java?
How do I format an ISO-8601 string 2020-02-10T22:55:13-08:00 into a custom format like 1:30pm? I kept getting unparseable date exception. My code snippet is below:
String string = "2020-02-10T22:55:13-08:00";
SimpleDateFormat sdfSource = new…

selbay84
- 47
- 1
- 2
- 7
2
votes
1 answer
My job quote calculator is returning "X is not a function"
This is a corporate massage job quote calculator.
From the user, we collect:
Start time
End time
Number of clients needing a massage
We then use those variables in conjunction with our business rules of time needed per person and hourly rate for a…

kobyrthr
- 51
- 4