Strange Date Format in XML, Convert to Ruby DateTime Object

NobCefpeemo

New Member
This is a tough one to google for. I have an XML document that's a million lines long, and I'm using Ruby to parse it and remove entries I don't care about. One my my criteria is the date created. These XML blocks have funny looking dates in them\[code\]<attribute name="datemodified" type="date">362895460.21263897418975830078</attribute><attribute name="datecreated" type="date">356831173.15324598550796508789</attribute>\[/code\]I've never seen dates formatted like that exactly. They look similar to if you did something like \[code\]Time.now.to_f\[/code\]. Even so I don't know how I'd turn those into Ruby DateTime objects. If you can even identify how these times are created, or what they mean, that would be super helpful.If it helps, this XML file was originally created by a Mac OS X application known as "Things".Thanks for reading!Update: I've created two more entries and recorded the times at which i created them:From JULY-02-2012 9:57 AM\[code\]<attribute name="datemodified" type="date">362941035.01687598228454589844</attribute> <attribute name="datecreated" type="date">362940986.89370900392532348633</attribute>\[/code\]From JULY-02-2012 9:58 AM\[code\]<attribute name="datemodified" type="date">362941107.69538801908493041992</attribute><attribute name="datecreated" type="date">362941080.53793197870254516602</attribute>\[/code\]I couldn't get down to the second on accuracy, but i did make them about minute apart... Which makes it seem that these are in fact seconds... But... from some random date. Maybe the developer's birthday :)Doing some quick math, it would appear that the randomish date is right around 2000-12-31 16:09:43 -0800, or perhaps 01/01/01, for ease of memory... And 978336000 in seconds.
 
Back
Top