INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: "Date" field in MPL  (Read 2635 times)

sraymond

  • Guest
"Date" field in MPL
« 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-
Logged

lee269

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 575
  • sleep eat sleep eat sleep eat
Re:"Date" field in MPL
« Reply #1 on: October 11, 2003, 10:36:11 am »

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

sraymond

  • Guest
Re:"Date" field in MPL
« Reply #2 on: October 13, 2003, 12:31:33 pm »

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

NoCodeUK

  • Citizen of the Universe
  • *****
  • Posts: 1820
Re:"Date" field in MPL
« Reply #3 on: October 14, 2003, 11:26:32 am »

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
Logged
"It's called No Code because it's full of code. It's misinformation." - Eddie Vedder

sraymond

  • Guest
Re:"Date" field in MPL
« Reply #4 on: October 14, 2003, 01:20:10 pm »

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

lee269

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 575
  • sleep eat sleep eat sleep eat
Re:"Date" field in MPL
« Reply #5 on: October 14, 2003, 02:21:09 pm »

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... :)
Logged

sraymond

  • Guest
Re:"Date" field in MPL
« Reply #6 on: October 14, 2003, 03:37:26 pm »

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:
Quote
   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);
   }
Logged
Pages: [1]   Go Up