rfc3339

What pattern should be used to parse RFC 3339 datetime strings in java

倾然丶 夕夏残阳落幕 提交于 2020-06-24 08:38:29
问题 This seems to be a common question with many different answers. Before you answer, I have used both joda-time and atomdate and they work great. My interest here is not what library to use but instead a clarification on how RFC pattern should be defined in java. Research From my understanding and this answer RFC 3339 is a profile of ISO 8601. PHP clearly defines the RFC 3339 datetime pattern to be Y-m-d\TH:i:sP . If we were to transfer this definition to java 7 (to my knowledge) we would end

Unmarshal incorrectly formatted datetime

耗尽温柔 提交于 2020-04-05 10:15:03
问题 Background I am learning Go and I'm trying to do some JSON unmarshaling of a datetime. I have some JSON produced by a program I wrote in C, I am outputting what I thought was a valid ISO8601 / RFC3339 timezone offset. I'm using strftime with the following format string: %Y-%m-%dT%H:%M:%S.%f%z (Note that %f is not supported by strftime natively, I have a wrapper that replaces it with the nanoseconds). This will then produce the following result: 2016-08-08T21:35:14.052975+0200 Unmarshaling

Unmarshal incorrectly formatted datetime

不打扰是莪最后的温柔 提交于 2020-04-05 10:13:33
问题 Background I am learning Go and I'm trying to do some JSON unmarshaling of a datetime. I have some JSON produced by a program I wrote in C, I am outputting what I thought was a valid ISO8601 / RFC3339 timezone offset. I'm using strftime with the following format string: %Y-%m-%dT%H:%M:%S.%f%z (Note that %f is not supported by strftime natively, I have a wrapper that replaces it with the nanoseconds). This will then produce the following result: 2016-08-08T21:35:14.052975+0200 Unmarshaling

RFC 3339 how make a dateTime from

旧时模样 提交于 2019-12-30 18:06:11
问题 I'm trying to format a date passed from a google plus Api thats like the guide says in RFC 3339 format: PUBLISHED-> datetime-> The time at which this activity was initially published. Formatted as an RFC 3339 timestamp. So by php documentation i found that: DATE_RFC3339 Same as DATE_ATOM (since PHP 5.1.3) And that both format are something like: "Y-m-d\TH:i:sP" Actually the output of the Google api is something like: 2014-01-22T10:36:00.222Z When I'm trying to launch command like: $date =

How to convert Python's .isoformat() string back into datetime object [duplicate]

狂风中的少年 提交于 2019-12-29 03:12:13
问题 This question already has answers here : Convert timestamps with offset to datetime obj using strptime (4 answers) How do I parse an ISO 8601-formatted date? (26 answers) Closed 4 years ago . So in Python 3, you can generate an ISO 8601 date with .isoformat(), but you can't convert a string created by isoformat() back into a datetime object because Python's own datetime directives don't match properly. That is, %z = 0500 instead of 05:00 (which is produced by .isoformat()). For example: >>>

RFC822 Timezone Parsing in Java

梦想的初衷 提交于 2019-12-22 04:42:45
问题 I have a JS date that is being converted by Dojo into RFC822 format. The function call - dojo.date.toRfc3339(jsDate), generates the following date - 2007-02-26T20:15:00+02:00. I have an application that uses a Java date SimpleDateFormat to parse in the dates generated above. I am having problems parsing this date format due to the timezone. I have attempted to use yyyy-mm-DD'T'hh:mm:ssZ This fails as the 'Z' for timezone doesn't expect a ':' character. Does anyone know how I would specify a

Parsing rfc3339 dates with NSDateFormatter in iOS 4.x and MacOS X 10.6: impossible?

血红的双手。 提交于 2019-12-20 11:48:26
问题 Parsing a rfc3339 date with NSDateFormatter appears to be impossible, in the general case. Am I wrong? [Edit 2 years later: there is now a way! See below and footnote.] A not-especially-malleable web service is feeding me dates like: 2009-12-31T00:00:00-06:00 Rfc3339 compliant, default output of the jaxb library they're using. Note the colon, which rfc3339 requires when the offset isn't a literal "z": time-numoffset = ("+" / "-") time-hour ":" time-minute time-offset = "Z" / time-numoffset I

Output RFC 3339 Timestamp in Java

最后都变了- 提交于 2019-12-18 12:05:52
问题 I want to output a timestamp with a PST offset (e.g., 2008-11-13T13:23:30-08:00). java.util.SimpleDateFormat does not seem to output timezone offsets in the hour:minute format, it excludes the colon. Is there a simple way to get that timestamp in Java? // I want 2008-11-13T12:23:30-08:00 String timestamp = new SimpleDateFormat("yyyy-MM-dd'T'h:m:ssZ").format(new Date()); System.out.println(timestamp); // prints "2008-11-13T12:23:30-0800" See the difference? Also, SimpleDateFormat cannot

What exactly does the T and Z mean in timestamp?

僤鯓⒐⒋嵵緔 提交于 2019-12-17 23:20:18
问题 I have this timestamp value being return by a web service "2014-09-12T19:34:29Z" I know that it means timezone, but what exactly does it mean? And I am trying to mock this web service, so is there a way to generate this timestamp using strftime in python? Sorry if this is painfully obvious, but Google was not very helpful and neither was the strftime() reference page. I am currently using this : x.strftime("%Y-%m-%dT%H:%M:%S%Z") '2015-03-26T10:58:51' 回答1: The T doesn't really stand for