iso8601

Storing a calendar day in sqlite database

I need to store items with a calendar date (just the day, no time) in a sqlite database. What's the best way to represent the date in the column? Julian days and unix seconds come to mind as reasonable alternatives. If I go with a unit other than days at what clock time should it be? Update: I am aware of ISO8601 and actually used it...

The right ISO 8601 format

I am refactoring some code for a Ruby library. This code includes a Date parser. One of the tests was to parse this string "2008-02-20T8:05:00-010:00" which is supposed to be ISO 8601. The previous code would actually output: "Wed Feb 20 18:05:00 UTC 2008". My new code outputs that: "Wed Feb 20 16:05:00 UTC 2008". My question is: which...

How do I translate a ISO 8601 datetime string into a Python datetime object?

I'm getting a datetime string in a format like "2009-05-28T16:15:00" (this is ISO 8601, I believe) one hack-ish option seems to be to parse the string using time.strptime and passing the first 6 elements of the touple into the datetime constructor, like: datetime.datetime(*time.strptime("2007-03-04T21:08:12", "%Y-%m-%dT%H:%M:%S")[:6]) ...

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

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.datetim...

How to parse an ISO-8601 duration in Objective C?

I'm looking for an easy way to parse a string that contains an ISO-8601 duration in Objective C. The result should be something usable like a NSTimeInterval. An example of an ISO-8601 duration: P1DT13H24M17S, which means 1 day, 13 hours, 24 minutes and 17 seconds. ...

.net parsing Iso8601 date time

I have a string "2009-10-08 08:22:02Z" which is iso8601 format. How do I use DateTime to parse this format ? ...

Javascript Date to IS8601 format?

Hi, I am learning javascript and I am trying to figure out if there is a simple way to convert a standard formatted Date to ISO8601 format (YYYY-MM-DDThh:mm:ssTZD). Advices? ...

Which ISO8601 date/time incl. timezone format to use for maximum success across languages?

The ISO8601 format for date/time representations supports many variations of format to express the same information. I know that not all languages have libraries that support the range of the standard - for example, I've had problems parsing the different possible formats of the timezone using Java's SimpleDateFormat API. Given the cho...

DataView.RowFilter an ISO8601

I have a DataTable (instance named: TimeTable) whose DefaultView (instance named: TimeTableView) I am trying to use to filter based on a date. Column clock_in contains an ISO8601 formatted string. I would like to select all the rows in this DataTable/DefaultView between 2009-10-08T08:22:02Z and 2009-10-08T20:22:02Z. What would I have to...

ISO Time (ISO 8601) in Python?

I have a file. In Python, I would like to take its creation time, and convert it to an ISO time (ISO 8601) string while preserving the fact that it was created in the Eastern Time Zone. How do I take the file's ctime and convert it to an ISO time string, that indicates the Eastern Time Zone (and takes into account daylight savings time,...

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

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...

Converting ISO8601-compliant String to java.util.Date

solved, see answer below Hi, I am trying to convert an ISO8601 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 h...

Will PHP DateInterval support decimals to add to a date/time?

According to wikipedia - en.wikipedia.org/wiki/ISO_8601 , it should be possible to do this (assuming PHP supports the full ISO 8601): $date = new DateTime(date('Y-m-d H:i:s', time())); // current time - create date time object date_add($date, new DateInterval("PT".round(2.5,2)."H")); //add 2.5 hours (throws exception unknown or bad form...

Java SimpleDateFormat for time zone with a colon seperator?

I have a date in the following format: 2010-03-01T00:00:00-08:00 I have thrown the following SimpleDateFormats at it to parse it: private static final SimpleDateFormat[] FORMATS = { new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"), //ISO8601 long RFC822 zone new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"), //ISO8601 long l...

Timezones and the DateTimeField - Django

Hi folks, I'm trying to implement a "time ago" feature, for the displaying of items on a site. As I'm caching the pages I wish to use javascript in order to render the "time ago". Javascript knows local time and problably the Timezone of the local machine so I could play with that, but that would require to hard code the server's timez...

How do I output an ISO-8601 formatted string in Javascript?

I have a date object from which I'd like to render an HTML snippet like <abbr title="2010-04-02T14:12:07">A couple days ago</abbr>. I have the "relative time in words" portion from another library. How do I render the title portion? I've tried the following: isoDate: function(msSinceEpoch) { var d = new Date(msSinceEpoch); return d...

Parse ISO8601 date in Objective-C (iPhone OS SDK)

How do I parse "2010-04-30T00:45:48.711127" into an NSDate? (and maintain all precision) ...

RFC822 Timezone Parsing in Java

Hi, 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 th...

Timeago + DateJS = NaN

I'm trying to use timeago (source), with datejs, and it's not working. Here's some sample code I'd expect to work (given that timeago and datejs are loaded): >>> d = new Date() Mon Jun 21 2010 13:24:37 GMT-0400 (EST) { _orient=1, more...} >>> d.toISOString() // datejs.toISOString "2010-06-21T17:24:37.501Z" // this is a valid ...

How can I convert an ISO8601 timestamp into unix time in Perl?

Given a string that represents a date/time in ISO8601 format (e.g. 20100723T073000), I need to ultimately parse this into a user-supplied format using a general strftime format string. In order to do that, I need to convert the ISO8601 timestamp to a Unix timestamp. There are a huge amount of date/time manipulation modules for Perl and I...