Questions tagged [datetime-parsing]

423 questions
0
votes
1 answer

android parse string to date - incorrect date

I've spent a lot of time and I still do not understand why this is happening. In the code below, the time changes correctly, the date is not. String dtAll = mDate + " " + mTime; Date dat = new Date(); @SuppressLint("SimpleDateFormat")…
Kamil
  • 113
  • 1
  • 10
0
votes
1 answer

Parsing a string to a datetime does not return the correct time

In Android...I am expecting 3:12 pm as time out put of the following code but I get 4:12 pm. Whats the correct way to parse this date time format. String dt = "2018-09-02T19:12:00-0400"; SimpleDateFormat dateFormat = new…
YKDev
  • 31
  • 3
0
votes
1 answer

String to Date, not accordance

import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class formatTest { public static void main(String[] args){ String str = "2017-08-07 6:6:6"; SimpleDateFormat sdf = new…
fim
  • 9
  • 1
0
votes
2 answers

SimpleDateFormat Parsing on Android

I am trying to parse the following date/time: Wed, 29 Aug 2018 12:56:00 +0200 Currently, I am using the following code which works on my Android emulator but on my actual phone I get a "java.text.ParseException: Unparseable date" SimpleDateFormat…
0
votes
2 answers

DateFormat returning wrong hour

I am trying to parse the string "20/08/18 13:21:00:428" using the DateFormat class and a formatting pattern of "dd/MM/yy' 'HH:mm:ss:SSS". The Timezone is set to BST. The date returned for the above is correct but the time is getting returned as 08…
0
votes
2 answers

Not able to convert the string to date on Android

I have obtained a string from an API in form of 2017-04-23T19:47:39+00:00 How do i convert it into date of format "2017-04-23T19:47:39-0000"? I tried the following but it gave ParseException String created_at_string =…
0
votes
1 answer

How to parse 2018-06-19T05:50:31.000+0000 date string to Date

I tried this way but it throws an exception. DateFormat date = new SimpleDateFormat("YYYY-MM-DDThh:mm:ssZ"); Date result = date.parse(time); I am getting this exception: java.text.ParseException: Unparseable date:…
0
votes
2 answers

java.time.format.DateTimeParseException using DateTimeFormatter

I have this code: DateTimeFormatter formatter = new DateTimeFormatterBuilder() .appendPattern(DateType.DATE_FORMAT) .appendOffset("+HH:mm", "+00:00") …
All_Safe
  • 1,339
  • 2
  • 23
  • 43
0
votes
3 answers

How to parse "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" date format to simple in Android?

How do I can parse this date 2018-01-09T11:11:02.0+03:00 to dd.MM.yyyy hh:mm format in Android? And what does T between 09 and 11 mean? Thanks. I don't know how the back-end developer got this format. I am using Java.
picKit
  • 412
  • 1
  • 4
  • 14
0
votes
1 answer

Convert a String time to a localtime to compare

I am trying to figure out the math to verify shifts are getting correct breaks, when I query the api I get the following response: "StartDate": "4/25/2018", "EndTime": "8:30PM", "StartDayNumber": 1, "StartTime": "7:30PM", …
0
votes
0 answers

D3 v4 simple bar chart - date always returns null. timeParsing/format issue

For some odd reason, my dates won't properly show up on my bar chart. When checking for errors, my dates always show up as "null" in the console. My professor and I have tried re-arranging the format of the code regarding the dates, as well as the…
0
votes
4 answers

Parse ZonedDateTime.now() with DateTimeFormatter in Java

I am trying to parse the current timestamp with specific format but every try I keep getting a java.time.format.DateTimeParseException. My code: ZonedDateTime.parse( ZonedDateTime.now().toString(), DateTimeFormatter.ofPattern("dd.MM.yyyy…
Arthur Eirich
  • 3,368
  • 9
  • 31
  • 63
0
votes
2 answers

Parse String to Date format in Spring

I am trying to update google calendar event start and end datetime in spring class.But i am getting DateFormat exception.I am able to get particular event and display in modal popup.I am using kendo directives datepicker.Now if the user edits the…
Sachin HR
  • 450
  • 11
  • 28
0
votes
1 answer

SimpleDateFormat parse exception on Android 7+

I'm trying to parse a date and convert to a Timestamp. On Android 6 it works, but on Android 7 it throws an exception. Can any tell me how to fix it? private long getCorrectDate(String date) { SimpleDateFormat dateFormat = new…
Peter
  • 2,480
  • 6
  • 39
  • 60
0
votes
3 answers

SimpleDateFormat - how to prevent timezone being reformatted

I am having issues with SimpleDateFormat changing the appearance of a datetimestamp when I parse a String and then format the resulting Date. The code snippet below demonstrates the issue. Note: I know it seems futile to parse and then format the…