Questions tagged [datetime-parsing]
423 questions
0
votes
2 answers
C# Datetime.ParseExact for a parsing a string containing UTC text
I have a date time string that looks like this:
13.08.2014 17:17:45.000 UTC-60
I am trying to parse it into a C# date time object but it is not working as I expected.
Here is what I tried:
DateTime.ParseExact(dateToParse, "dd.MM.yyyy hh:mm:ss.fff…

Cybercop
- 8,475
- 21
- 75
- 135
0
votes
2 answers
Java Timestamp accepting dashes
I formatted a regex for HHMMSS.FFFFF as such:
^([0-1]\d|2[0-3])([0-5]\d)([0-5]\d).(\d{5})
and used to to create a SimpleDateFormat as such
String format = "HHMMSS.FFFFF";
SimpleDateFormat sdf = new SimpleDateFormat(format);
Then tried to create a…

user2568374
- 1,164
- 4
- 11
- 21
0
votes
3 answers
ParseException while parsing date from String to date Object
I'm getting a ParseException while parsing a date from String to Date object. The date string also contains a timezone. I'm using this code:
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss…

user2142786
- 1,484
- 9
- 41
- 74
0
votes
3 answers
How to parse offset it is not specified?
I have time 12:00:00 in format HH:mm:ss.
I know that this time comes from server witch is setup with +3 offset.
If i use SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");, it parses time with regard to device, which can be in a different…

Yarh
- 4,459
- 5
- 45
- 95
0
votes
2 answers
ParseException trying to parse Date from string with + in it
I have a problem to parse my date from string
This is my date
String startedFrom = "Fri,+31+Dec+3999+23:00:00+GMT"
DateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy kk:mm:ss z", Locale.ENGLISH);
Date result = df.parse(startedFrom);
what I…

mbrc
- 3,523
- 13
- 40
- 64
0
votes
4 answers
ParseException when trying to parse Date string
I have a piece of code written to parse date string -
DateFormat cal = new SimpleDateFormat("yyyy-MM-dd hh:mm");
cal.setLenient(false);
try {
cal.parse("2018-01-01 14:42");
}
catch (Exception e)
{
…

Prateek Narendra
- 1,837
- 5
- 38
- 67
0
votes
1 answer
How to get the runTime of an active task according to its GMT lanuchTime in Spark?
I want to get the runtime of an active task. In the REST API page of /applications/[app-id]/stages/[stage-id], I can get tasks info in detail.
enter image description here
You can see, the executorRunTime is 0 when a task is not completed. I think I…

fan
- 11
- 3
0
votes
1 answer
joda time unexpected format
I'm trying to use Joda-Time library to convert a String date and time to Date but the result I get is not the expected.
From the server I get:
08/11/2017 12:30
10/11/2017 12:30
Joda converts it to:
2017-01-08T12:30:00.000+02:00
…

chris_cs
- 35
- 6
0
votes
2 answers
Compare String time to Local Server Time
Have a string object with a specific format of date.
Need to check if that dateStr is after the current time on local machine.
Having trouble with conversions and LocalDateTime
String dateStr = "Oct 27 2017 02:29:00 GMT+0000";
public static final…

Ashok Goli
- 5,043
- 8
- 38
- 68
0
votes
2 answers
How can I parse Twitter API dates into java.time.Instant?
I am trying to parse the dates that come from the Twitter API into the new Instant class from Java 8. FYI, this is the format Wed Aug 09 17:11:53 +0000 2017.
I don't want to deal with / set a time zone, as one is specified in the string already. I…

Fabien Warniez
- 2,731
- 1
- 21
- 30
0
votes
2 answers
Parsing datetime to UTC
I have this date => 2017-10-17 10:23:30 UTC TIME
I'm parsing it like this
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
TimeZone tz = TimeZone.getDefault(); // +03:00
dateFormat.setTimeZone(tz);
…

Saef Myth
- 287
- 8
- 19
0
votes
5 answers
Converting String into LocalDateTime using Java 8 DateTimeFormatter
I'm using Java 8 and I have a string in my .txt file which I want to convert into a LocalDateTime object.
String time1 = "2017-10-06T17:48:23.558";
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("dd.MM.yyyy. HH:mm:ss");
LocalDateTime…

mdenci
- 297
- 2
- 6
- 17
0
votes
2 answers
DST changes caused an java.text.ParseException: Unparseable date
Following is the code snippet which is throwing an exception:
SimpleDateformat dateFormatter = new SimpleDateFormat("yyyyMMddHHmm");
Date date = dateFormatter.parse("201710010200");
The code above threw exception for all the dates after 2:00 A.M.…

Raghav Agarwal
- 43
- 6
0
votes
1 answer
Dates are not getting displayed according to the customize TimeZone. Always picking the default timezone
Tried all possible combinations, created a Custom JsonDeserializer class as well modified the DateFormat as per my need. But still no fruitful result.
But result always display date in 'EST' Sat Jan 01 14:08:56 EST 2000.
I want my date to be…

KapilArora
- 11
- 1
- 2
0
votes
3 answers
Parsing string to datetime in joda
I'm crazy about this parsing.
Code as below:
try {
String if_modified_since = "Sat Sep 23 23:08:37 CST 2017";
DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("EEE MMM dd HH:mm:ss zzz yyyy");
DateTime dt_if_modified_since…

roast_soul
- 3,554
- 7
- 36
- 73