INTERACT FORUM
Windows => Third Party Plug-ins, Programs, and Skins => Topic started by: sraymond on October 08, 2003, 09:26:53 pm
-
I've searched INTERACT to no avail... I can't figure out what the "Date" field in the MPL represents. What is the formula/logic required to convert it to a human-recognizable date?
Thanks!
Scott-
-
Scott
I posted in your Albumview XSLT thread before I saw this one. Since then Ive taken a look at an MC created MPL file.
Im pretty sure now its seconds from 1/1/1970. Some quick calculations seem to confirm it.
The disclaimer here though is that Im such a non-programmer I dont even know what an MPL file is. But I hope it helps.
-
Bump.
Scott
I posted in your Albumview XSLT thread before I saw this one. Since then Ive taken a look at an MC created MPL file.
Im pretty sure now its seconds from 1/1/1970. Some quick calculations seem to confirm it.
The disclaimer here though is that Im such a non-programmer I dont even know what an MPL file is. But I hope it helps.
Maybe it stores a date in years differently? As I mentioned in the other thread, I have a Date of 2000 and the value is "36526".
Scott-
-
Scott,
Dunno if this helps but it appears that MC is using the same date format as MS Excel. I just entered a date of 01/01/2000 into Excel and converted it into a general format cell and I got the same number as you...36526. So when you enter just a year on its own it defaults to the 1 of Jan for that year but only displays the year...
Adam
-
Thanks Adam!
A bit of googling, and it would seem that this is like a serial date in Excel (it represents the number of days since 1/1/1900 and the fraction is the percentage of a day - aka time). I just need to convert to Julian and all it well.
This should be easy enough. Thanks again!
Scott-
-
Scott
Glad you figured it out. Think I understand your question better now, and I think it does store date in years differently. In the playing now MPL I created and imported into Excel on Sunday the 'Date' field seems to be an Excel date serial number. Its the other date/times - last played, imported, modified etc that are seconds from Jan 1 1970 from what I can tell, eg 1054153374=Date Created=28/05/2003 20:22.
My usual disclaimer above applies. And for now I bow out of muddying the waters for real programmers... :)
-
Scott
Glad you figured it out. Think I understand your question better now, and I think it does store date in years differently. In the playing now MPL I created and imported into Excel on Sunday the 'Date' field seems to be an Excel date serial number. Its the other date/times - last played, imported, modified etc that are seconds from Jan 1 1970 from what I can tell, eg 1054153374=Date Created=28/05/2003 20:22.
My usual disclaimer above applies. And for now I bow out of muddying the waters for real programmers... :)
Yeah... that's a bit confusing, then. The "Date" field stores it as a serial date (aka Julian Date minus Julian Date of 1/1/1900) with the decimal being the time - and the others use seconds since 1/1/1970. I wonder why that is?
Again, thanks for helping me understand.
Scott-
P.S. If anyone's interested in how you convert a serial date to a calendar date, it's:
function ConvertSerialDate(SerialDate) {
var l;
var n;
var i;
var j;
var Day;
var Month;
var Yeary;
l = SerialDate + 68569 + 2415019;
n = Math.floor(( 4 * l ) / 146097);
l = l - Math.floor(( 146097 * n + 3 ) / 4);
i = Math.floor(( 4000 * ( l + 1 ) ) / 1461001);
l = l - Math.floor(( 1461 * i ) / 4) + 31;
j = Math.floor(( 80 * l ) / 2447);
Day = l - Math.floor(( 2447 * j ) / 80);
l = Math.floor(j / 11);
Month = j + 2 - ( 12 * l );
Year = 100 * ( n - 49 ) + i + l;
document.write(Month + '/' + Day + '/' + Year);
}