iso8601

How do I translate an ISO 8601 datetime string into a Python datetime object? [duplicate]

允我心安 提交于 2019-11-25 22:37:17
问题 This question already has answers here : How do I parse an ISO 8601-formatted date? (26 answers) Closed 5 years ago . I\'m getting a datetime string in a format like \"2009-05-28T16:15:00\" (this is ISO 8601, I believe). One hackish option seems to be to parse the string using time.strptime and passing the first six elements of the tuple into the datetime constructor, like: datetime.datetime(*time.strptime(\"2007-03-04T21:08:12\", \"%Y-%m-%dT%H:%M:%S\")[:6]) I haven\'t been able to find a \

Parsing ISO 8601 date in Javascript

佐手、 提交于 2019-11-25 22:19:34
Need help/tips on converting an ISO 8601 date with the following structure into javascript. CCYY-MM-DDThh:mm:ssTZD I'd like to frmat the date like so: January 28, 2011 - 7:30PM EST I'd like to keep this solution as clean and minimal as possible. YOU datejs could parse following, you might want to try out. Date.parse('1997-07-16T19:20:15') // ISO 8601 Formats Date.parse('1997-07-16T19:20:30+01:00') // ISO 8601 with Timezone offset Edit: Regex version x = "2011-01-28T19:30:00EST" MM = ["January", "February","March","April","May","June","July","August","September","October","November", "December"

How do I parse an ISO 8601-formatted date?

半世苍凉 提交于 2019-11-25 22:18:11
问题 I need to parse RFC 3339 strings like \"2008-09-03T20:56:35.450686Z\" into Python\'s datetime type. I have found strptime in the Python standard library, but it is not very convenient. What is the best way to do this? 回答1: The python-dateutil package can parse not only RFC 3339 datetime strings like the one in the question, but also other ISO 8601 date and time strings that don't comply with RFC 3339 (such as ones with no UTC offset, or ones that represent only a date). >>> import dateutil

Converting ISO 8601-compliant String to java.util.Date

时光怂恿深爱的人放手 提交于 2019-11-25 22:13:25
问题 I am trying to convert an ISO 8601 formatted String to a java.util.Date . I found the pattern yyyy-MM-dd\'T\'HH:mm:ssZ to be ISO8601-compliant if used with a Locale (compare sample). However, using the java.text.SimpleDateFormat , I cannot convert the correctly formatted String 2010-01-01T12:00:00+01:00 . I have to convert it first to 2010-01-01T12:00:00+0100 , without the colon. So, the current solution is SimpleDateFormat ISO8601DATEFORMAT = new SimpleDateFormat(\"yyyy-MM-dd\'T\'HH:mm:ssZ\"

How to create a date time stamp and format as ISO 8601, RFC 3339, UTC time zone?

无人久伴 提交于 2019-11-25 22:07:23
问题 How to generate a date time stamp, using the format standards for ISO 8601 and RFC 3339? The goal is a string that looks like this: \"2015-01-01T00:00:00.000Z\" Format: year, month, day, as \"XXXX-XX-XX\" the letter \"T\" as a separator hour, minute, seconds, milliseconds, as \"XX:XX:XX.XXX\". the letter \"Z\" as a zone designator for zero offset, a.k.a. UTC, GMT, Zulu time. Best case: Swift source code that is simple, short, and straightforward. No need to use any additional framework,

Is there a simple way of converting an ISO8601 timestamp to a formatted NSDate?

旧城冷巷雨未停 提交于 2019-11-25 21:50:44
If I use the following code: NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm"]; NSDate *myDate = [dateFormatter dateFromString:@"2010-01-28T15:22:23.863"]; NSLog(@"%@", [dateFormatter stringFromDate:myDate]); It is successfully converted to a Date object, however, I cannot seem to format it any other way than yyyy-MM-dd'T'HH:mm , i.e. what gets logged is 2010-01-28T15:22:23 If I change the dateFormat to say [dateFormatter setDateFormat:@"yyyy-MMMM-d'T'HH:mm"]; the Date object is null... So my ultimate question is how to format