iso8601

Extracting time from timestamp

梦想与她 提交于 2019-12-20 07:58:04
问题 I'm trying to extract the time section from an ISO8601 timestamp. e.g. From the following timstamp "0001-01-01T17:45:33" I want to extract this part "17:45:33" . 回答1: you have a few options. lets say you have it in a variable char array called string . now if you know that it the time will always be at the end of the string it`s very easy you can just do: #define TIMEWIDTH 8 #include <stdio.h> #include <string.h> int main() { const char string[] = {"0001-01-01T17:45:33\0"}; unsigned int

java.text.Parse Exception : Unparseable Date

≯℡__Kan透↙ 提交于 2019-12-19 19:57:04
问题 I have the following code: String ModifiedDate = "1993-06-08T18:27:02.000Z" ; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); Date ModDate = sdf.parse(ModifiedDate); I am getting the following exception even though my date format is fine... java.text.ParseException: Unparseable date: "1993-06-08T18:27:02.000Z" at java.text.DateFormat.parse(DateFormat.java:337) 回答1: The Z pattern latter indicates an RFC 822 time zone. Your string String ModifiedDate = "1993-06-08T18

How to parse an ISO8601 date [duplicate]

南笙酒味 提交于 2019-12-19 12:24:19
问题 This question already has answers here : How to parse a date string into an NSDate object in iOS? (7 answers) Closed 6 years ago . I got string of date regarding this format: 2011-12-29T09:09:06-0500 How can I convert this into a date object? 回答1: Try this solution NSString *dateString = @"2011-12-29T09:09:06-0500"; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"]; NSDate *dateFromString = [dateFormatter dateFromString

How to parse an ISO8601 date [duplicate]

孤人 提交于 2019-12-19 12:23:59
问题 This question already has answers here : How to parse a date string into an NSDate object in iOS? (7 answers) Closed 6 years ago . I got string of date regarding this format: 2011-12-29T09:09:06-0500 How can I convert this into a date object? 回答1: Try this solution NSString *dateString = @"2011-12-29T09:09:06-0500"; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"]; NSDate *dateFromString = [dateFormatter dateFromString

ECMAScript 5 Date.parse results for ISO 8601 test cases

旧街凉风 提交于 2019-12-18 17:32:17
问题 What result is right for the following test cases? //Chrome 19 Opera 12 Firefox 11 IE 9 Safari 5.1.1 console.log(Date.parse("2012-11-31T23:59:59.000Z"));//1354406399000 NaN NaN 1354406399000 NaN console.log(Date.parse("2012-12-31T23:59:59.000Z"));//1356998399000 1356998399000 1356998399000 1356998399000 1356998399000 console.log(Date.parse("2012-12-31T23:59:60.000Z"));//NaN NaN NaN NaN 1356998400000 console.log(Date.parse("2012-04-04T05:02:02.170Z"));//1333515722170 1333515722170

How to specify time zone (UTC) when converting to Unix time? (Python)

霸气de小男生 提交于 2019-12-18 16:56:40
问题 I have a utc timestamp in the IS8601 format and am trying to convert it to unix time. This is my console session: In [9]: mydate Out[9]: '2009-07-17T01:21:00.000Z' In [10]: parseddate = iso8601.parse_date(mydate) In [14]: ti = time.mktime(parseddate.timetuple()) In [25]: datetime.datetime.utcfromtimestamp(ti) Out[25]: datetime.datetime(2009, 7, 17, 7, 21) In [26]: datetime.datetime.fromtimestamp(ti) Out[26]: datetime.datetime(2009, 7, 17, 2, 21) In [27]: ti Out[27]: 1247815260.0 In [28]:

Parse and create ISO 8601 Date and time intervals, like PT15M in PHP

痞子三分冷 提交于 2019-12-18 12:13:21
问题 A library and webservice I am using communicates time-intervals in ISO 8601 format: PnYnMnDTnHnMnS. I want to convert such formats to seconds. And vice versa. Seconds are a lot easier to calculate with. Example interval values are: PT1M or PT60S (1 minute) PT1H, PT60M or PT3600S (1 hour) I need two functions: parse from such values to seconds: iso8601_interval_to_seconds() and from seconds into such intervals: iso8601_interval_from_seconds() . The latter is rather simple, because it could be

What's the right way to parse an ISO8601 date in cocoa?

允我心安 提交于 2019-12-18 11:58:49
问题 I would like to parse ISO8601 dates in Cocoa, both for iOS 4+ and OSX 10.6+ There are a few questions about this on StackOverflow already, but in my opinion none of them contain good answers. Here's what I think constitutes a good answer: The answer should point to code with support for ISO8601. This code should compile cleanly under XCode 4 for both iOS 4+ and OSX 10.6+. The code should support all possible ISO8601 date formats. Please note that there are many, many possibilities here.

Turn postgres date representation into ISO 8601 string

吃可爱长大的小学妹 提交于 2019-12-17 23:27:25
问题 I'm trying to format a Postgres date representation into a ISO 8601 string. I'm assuming that there is a Postgres function that can do it, but I found the documentation short on examples. My query is SELECT now()::timestamp which returns [{{2016, 8, 9}, {3, 56, 55, 754181}}] I'm trying to get the date into a format that looks more like 2016-8-9T03:56:55+00:00 . What changes do I need to make to my query to make that happen? Thanks for your help. 回答1: I think I found a way to do the formatting

In what format is this date string?

北慕城南 提交于 2019-12-17 20:24:00
问题 Im trying to convert a bunch of NSStrings into NSDate objects. Here is an example string: 2013-04-25T15:51:30.427+1.00 But I can't figure out what format it is in, so far I have (The question marks are the bits I'm stumped with): yyyy-MM-ddTHH:mm:ss????zzz The main problem I'm having is with the '.427' part although if I'm making a mistake elsewhere, let me know :) Does anyone have any ideas? Or could point me to a list of all the possible date format specifiers? I found this: http://msdn