iso8601

What is the date format of e.g. 2020-06-26T21:04:18.1823633Z called?

两盒软妹~` 提交于 2020-07-09 12:46:18
问题 I’m using C# 4.6 to pass a datetime to a webservice that’s expecting it in a format like this: 2020-06-26T21:04:18.1823633Z , or yyyy-MM-ddTHH:mm:ss.fffffffZ . On this website I’m finding formats that are similar ( SortableDateTimePattern doesn’t have the Z and UniversalSortableDateTimePat­tern doesn’t have the T ), but not identical. Is this a standard datetime format in C# and if not what would be the cleanest way to generate it? 回答1: It is the standard ISO-8601 format https://en.wikipedia

What is the date format of e.g. 2020-06-26T21:04:18.1823633Z called?

丶灬走出姿态 提交于 2020-07-09 12:46:08
问题 I’m using C# 4.6 to pass a datetime to a webservice that’s expecting it in a format like this: 2020-06-26T21:04:18.1823633Z , or yyyy-MM-ddTHH:mm:ss.fffffffZ . On this website I’m finding formats that are similar ( SortableDateTimePattern doesn’t have the Z and UniversalSortableDateTimePat­tern doesn’t have the T ), but not identical. Is this a standard datetime format in C# and if not what would be the cleanest way to generate it? 回答1: It is the standard ISO-8601 format https://en.wikipedia

ISO 8601 DateTime representation

╄→尐↘猪︶ㄣ 提交于 2020-06-27 16:17:49
问题 Is this a valid ISO 8601 representation of DateTime? 20170704T09:30:00+0530 i.e. whether a combination of both the basic and extended formats can be used? Or should it only be either of these: 20170704T093000+0530 2017-07-04T09:30:00+05:30 回答1: In Wikipedia, it says that a combined date and time representation can be in basic or extended format, but both date and time must use the same format . In ISO 8601, there's no mention of a mixed representation as well - take a look the examples in

Create an ISO 8601 Duration in Javascript/Angular

旧巷老猫 提交于 2020-06-27 04:49:38
问题 How would I create a duration in JavaScript then format this as an ISO 8601 duration, for example 2 mins 30 seconds would be "PT2M30S". Could this be done with an $interval? Or can this be achieved with Date().getTime()? I have an interaction that I need to track time spent on, so would I get the date at the start or the interaction and then again at the end, subtract from each other then format as ISO 8601? Struggling to find correct syntax or a useful lib. 回答1: Moment is a very popular date

DateTimeParseException at index 0 with ThreeTenABP

大兔子大兔子 提交于 2020-05-16 03:25:11
问题 I'm trying to parse a time string with ThreeTenABP (because I have to support min SDK 19). I think the string is ISO 8601: 20200117T172638.000Z I get the following exception: org.threeten.bp.format.DateTimeParseException: Text '20200117T172638.000Z' could not be parsed at index 0 My code: Instant instant = Instant.parse("20200117T172638.000Z"); long time = instant.getEpochSecond(); Any help appreciated. Thanks in advance. 回答1: This is a little bit tricky alright. DateTimeFormatter

c# convert datetime object to iso 8601 string

ぃ、小莉子 提交于 2020-05-10 04:28:08
问题 I'm trying to convert a DateTime object to a ISO8601 string but keep getting wrong results. I've looked around on stackoverflow, but couldn't find the right solution. I start with a date time string of "2017-06-26T20:45:00.070Z" which deserialized by newtonsoft from json and converted to a DateTime object in C# equivalent to : var theTime = new DateTime(2017, 6, 26, 20, 45, 00, 70, DateTimeKind.Utc); Now i need the convert that time back to it's original UTC format string to use it in another

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

how to convert UTC date-time into ISO 8601 format in Java?

て烟熏妆下的殇ゞ 提交于 2020-03-03 07:43:25
问题 I want to format a UTC date-time in a specific ISO 8601 format like 2020-02-28T14:10:23+00:00 but not 2020-02-28T14:10:23Z . I don't want Z at the end but +00:00. I tried all the formats in simpleDateFormat doc and no format seems to give the above-mentioned one. I know both represents same time irrespective of the format but it needs to be formatted like that for backward compatibility reasons. Here is the java code that I tried, final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd

How to make milliseconds optional in @JsonFormat for Timestamp parsing with Jackson?

依然范特西╮ 提交于 2020-03-03 06:44:08
问题 I have the following declaration in my object: @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSX") private ZonedDateTime start; And when I parse timestamps like 2016-12-08T12:16:07.124Z (using Jackson Json De-serilaizer) it works fine, but once I receive timestamps without milliseconds (such as "2016-12-08T12:16:07Z"), it throws exception. How I can possibly make milliseconds optional in format specification? 回答1: If you are using Java 8 Try specifying .SSS