iso8601

Cannot parse String in ISO 8601 format, lacking colon in offset, to Java 8 Date

☆樱花仙子☆ 提交于 2019-11-26 22:47:43
I'm a little bit frustrated of java 8 date format/parse functionality. I was trying to find Jackson configuration and DateTimeFormatter to parse "2018-02-13T10:20:12.120+0000" string to any Java 8 date, and didn't find it. This is java.util.Date example which works fine: Date date = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSSZZZ") .parse("2018-02-13T10:20:12.120+0000"); The same format doesn't work with new date time api ZonedDateTime dateTime = ZonedDateTime.parse("2018-02-13T10:20:12.120+0000", DateTimeFormatter.ofPattern("yyyy-MM-dd'T'hh:mm:ss.SSSZZZ")); We should be able to format

Parsing ISO 8601 string to DateTime in .NET? [duplicate]

不想你离开。 提交于 2019-11-26 21:53:11
问题 This question already has an answer here: How to create a .NET DateTime from ISO 8601 format 7 answers I have a string, "2009-10-08 08:22:02Z", which is in ISO 8601 format. How do I use DateTime to parse this format? 回答1: string txt= "2009-10-08 08:22:02Z"; DateTime output = DateTime.ParseExact(txt, "u", System.Globalization.CultureInfo.InvariantCulture); The DateTime class supports the standard format string of u for this format I think for the ISO format (with the T separator), use "s"

Java Time Zone When Parsing DateFormat

寵の児 提交于 2019-11-26 21:51:06
问题 I had code that parses date as follows: String ALT_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; SimpleDateFormat sdf = new SimpleDateFormat( ALT_DATE_TIME_FORMAT); Date date = sdf.parse(requiredTimeStamp); And it was working fine, suddenly, this stopped working. It turns out an admin made some config changes on the server and the date is currently being returned as "2010-12-27T10:50:44.000-08:00" which is not parse-able by the above pattern. I have two questions: The first would be what

Convert String ISO-8601 date to oracle's timestamp datatype

被刻印的时光 ゝ 提交于 2019-11-26 21:48:15
问题 I have a ISO-8601 date in VARCHAR2 type, how can i convert that String date to timestamp in oracle db? Date Example: "2014-09-12T11:53:06+00:00" Maybe is something like the following but i not sure what is the format. SELECT to_timestamp_tz ('2014-09-12T11:53:06+00:00', ????) FROM DUAL 回答1: The date format model elements are listed in the Datetime Format Models documentation: SELECT to_timestamp_tz ('2014-09-12T11:53:06+00:00', 'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM') FROM DUAL TO_TIMESTAMP_TZ('2014

How to parse and generate DateTime objects in ISO 8601 format

点点圈 提交于 2019-11-26 21:47:04
问题 There is this SOAP web service that sends me datetime objects in the following format 2016-03-29T12:20:35.093-05:00 That is day 29 of March of year 2016. Hour: 12:20:35.093 (GMT-5). I want to be able to create a DateTime object, like this: DateTime.Now and get the string representation in the format described above and also the inverse operation, create a DateTime from a string like the one given above. I've tried the following in order to create the date: new DateTime(2016, 3, 29, 12, 20, 35

Format date in MySQL SELECT as ISO 8601

怎甘沉沦 提交于 2019-11-26 20:34:26
问题 I'm trying to grab the date from my database in a standard timestamp and display it as ISO 8601. I'm unable to easily do it in PHP so I'm trying to do it in my SELECT statement. This is what I have, but it displays an error: SELECT * FROM table_name ORDER BY id DESC DATE_FORMAT(date,"%Y-%m-%dT%TZ") What am I doing wrong? 回答1: The DATE_FORMAT(DateColumn) has to be in the SELECT list: SELECT DATE_FORMAT(date, '%Y-%m-%dT%TZ') AS date_formatted FROM table_name ORDER BY id DESC 回答2: DATE_FORMAT

Parsing an ISO8601 date/time (including TimeZone) in Excel

天大地大妈咪最大 提交于 2019-11-26 18:31:00
I need to parse an ISO8601 date/time format with an included timezone (from an external source) in Excel/VBA, to a normal Excel Date. As far as I can tell, Excel XP (which is what we're using) doesn't have a routine for that built-in, so I guess I'm looking at a custom VBA function for the parsing. ISO8601 datetimes look like one of these: 2011-01-01 2011-01-01T12:00:00Z 2011-01-01T12:00:00+05:00 2011-01-01T12:00:00-05:00 2011-01-01T12:00:00.05381+05:00 There is a (reasonably) simple way to parse an ISO timestamp WITHOUT the time zone using formulas instead of macros. This is not exactly what

What is the motivation for two different week-based-year definitions in JSR-310?

非 Y 不嫁゛ 提交于 2019-11-26 17:13:57
问题 These are the two fields in the package java.time.temporal : IsoFields.WEEK_BASED_YEAR WeekFields.ISO.weekBasedYear() ISO-8601 defines a so-called week date besides the other two kinds of date, namely the usual calendar date (consisting of year, month and day-of-month) and the ordinal date (consisting of year and day-of-year). A weekdate is defined in the format YYYY-'W'ww-e . w stands for the week-of-year, e for the numerical ISO-day-of-week. Y stands for the week-based-year and is identical

How do I get an ISO 8601 date on iOS?

拟墨画扇 提交于 2019-11-26 17:12:32
It's easy enough to get the ISO 8601 date string (for example, 2004-02-12T15:19:21+00:00 ) in PHP via date('c') , but how does one get it in Objective-C (iPhone)? Is there a similarly short way to do it? Here's the long way I found to do it: NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; dateFormatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ssZ"; NSDate *now = [NSDate date]; NSString *formattedDateString = [dateFormatter stringFromDate:now]; NSLog(@"ISO-8601 date: %@", formattedDateString); // Output: ISO-8601 date: 2013-04-27T13:27:50-0700 It seems an awful lot of

Java 8 Date and Time: parse ISO 8601 string without colon in offset [duplicate]

拜拜、爱过 提交于 2019-11-26 16:40:38
This question already has an answer here: Cannot parse String in ISO 8601 format, lacking colon in offset, to Java 8 Date 1 answer We try to parse the following ISO 8601 DateTime String with timezone offset: final String input = "2022-03-17T23:00:00.000+0000"; OffsetDateTime.parse(input); LocalDateTime.parse(input, DateTimeFormatter.ISO_OFFSET_DATE_TIME); Both approaches fail (which makes sense as OffsetDateTime also use the DateTimeFormatter.ISO_OFFSET_DATE_TIME ) because of the colon in the timezone offset. java.time.format.DateTimeParseException: Text '2022-03-17T23:00:00.000+0000' could