parseexception

ParseException - Can't figure out the right pattern

会有一股神秘感。 提交于 2019-12-11 03:18:46
问题 I have the following string: dateToParse = "Fri May 16 23:59:59 BRT 2014" , and want to parse it using DateFormat: DateFormat dateFormat = new SimpleDateFormat(pattern, Locale.getDefault()); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("America/Sao_Paulo")); cal.setTime(dateFormat.parse(dateToParse)); right now I'm trying it with pattern = "EEE MMM dd HH:mm:ss z yyyy" , but get this exception: java.text.ParseException: Unparseable date: "Fri May 16 23:59:59 BRT 2014" (at offset 0)

Android parseException unparseable date in specific devices?

徘徊边缘 提交于 2019-12-11 02:04:02
问题 In my android App I am converting a string to a date using the following method public Date convertToDate(String date) { //(input date format "Feb 18, 2013 01:32 AM") DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT); try { Date dateObj = dateFormat.parse(date); return dateObj; } catch (ParseException e) { e.printStackTrace(); } catch (Exception e) { Log.d("Utility", e.getMessage()); } return null; } It works fine in most of the mobile but for some

org.threeten.bp.format.DateTimeParseException: Text '2018-07-22T14:00:00-03:00' could not be parsed at index 19

拈花ヽ惹草 提交于 2019-12-08 09:18:20
问题 public static String formatter(String dateInPattern, String dateOutPattern) { OffsetDateTime dateInPatternFormat = OffsetDateTime.parse(dateInPattern, DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ")); Date dateInValue = DateTimeUtils.toDate(Instant.parse(dateInPatternFormat.toString())); OffsetDateTime dateOutPatternFormat = OffsetDateTime.parse(dateOutPattern); return dateOutPatternFormat.format(DateTimeFormatter.ofPattern(dateInValue.toString())); } I need to enter a date in this

MismatchedTokenException on hive create table query

[亡魂溺海] 提交于 2019-12-07 11:45:25
问题 I'm trying to create a Hive table with the following query: CREATE TABLE IF NOT EXISTS BXDataSet (ISBN STRING, BookTitle STRING, BookAuthor STRING, YearOfPublication STRING, Publisher STRING, ImageURLS STRING, ImageURLM STRING, ImageURLL STRING) COMMENT 'BX-Books Table' ROW FORMAT DELIMITED FIELDS TERMINATED BY ';' LINE TERMINATED BY '\n' STORED AS TEXTFILE; How when I submitted to Hive I got the following exception: MismatchedTokenException(-1!=301) at org.antlr.runtime.BaseRecognizer

MismatchedTokenException on hive create table query

ぐ巨炮叔叔 提交于 2019-12-05 17:24:58
I'm trying to create a Hive table with the following query: CREATE TABLE IF NOT EXISTS BXDataSet (ISBN STRING, BookTitle STRING, BookAuthor STRING, YearOfPublication STRING, Publisher STRING, ImageURLS STRING, ImageURLM STRING, ImageURLL STRING) COMMENT 'BX-Books Table' ROW FORMAT DELIMITED FIELDS TERMINATED BY ';' LINE TERMINATED BY '\n' STORED AS TEXTFILE; How when I submitted to Hive I got the following exception: MismatchedTokenException(-1!=301) at org.antlr.runtime.BaseRecognizer.recoverFromMismatchedToken(BaseRecognizer.java:617) at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer

hive command in bash script won't load file into table

∥☆過路亽.° 提交于 2019-12-04 05:49:54
问题 I am writing a bash script that - among other things - has to create a hive table and load a csv file (whose name is not known a priori) into that table. I have exported the name of the file foo.csv into the environment variable myfile and have tried the command hive --hiveconf mf=$myfile -e 'set mf; set hiveconf:mf; load data local inpath ${hiveconf:mf} into table mytable' It returns the error FAILED: ParseException line 1:23 mismatched input 'foo' expecting StringLiteral near 'inpath' in

Java ParseException while attempting String to Date parsing

与世无争的帅哥 提交于 2019-12-04 04:33:10
问题 I'm having a hard time Parsing/Formatting a Date string received back from a web service. I've attempted multiple approaches, but with no luck. Sample Date String: 2011-10-05T03:00:00Z Exception: W/System.err(10072): java.text.ParseException: Unparseable date: "2011-10-05T05:00:00Z" (at offset 10) W/System.err(10072): at java.text.DateFormat.parse(DateFormat.java:626) Sample Code: SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:SSSS"); Date date = formatter.parse(info

ParseException Java

别来无恙 提交于 2019-12-04 03:13:12
问题 I am writing an appointment program that allows the user to input appointment dates, description, and type of appointment. Everything works correctly until they make a selection to "Print Range" which prints a range of dates, when they choose to do this it tells them to enter START date and an END date, the program then pulls all of the appointments from between those dates and displays them into the output box. Here are the errors I am getting with print range : AppointmentNew.java:68:

Not able to convert the string to date on Android

旧城冷巷雨未停 提交于 2019-12-02 19:53:09
问题 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 = "2017-04-23T19:47:39+00:00"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); Date created_at = sdf.parse(created_at_string); Exception: 06-22 18:18:32.517 10396-10396/com.harit.abs W/System.err: java.text.ParseException: Unparseable date: ""2018-04-29T10

Not able to convert the string to date on Android

你说的曾经没有我的故事 提交于 2019-12-02 11:38:00
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 = "2017-04-23T19:47:39+00:00"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); Date created_at = sdf.parse(created_at_string); Exception: 06-22 18:18:32.517 10396-10396/com.harit.abs W/System.err: java.text.ParseException: Unparseable date: ""2018-04-29T10:55:37+00:00"" at java.text.DateFormat.parse(DateFormat.java:358) at com.harit.abs.Sync_Activity.bu(Sync