INFO KNOWLEDGE

Mengubah Format Serial Date Excel ke SQL / PHP


function ExcelSerialDateToDMY($nSerialDate)

{

    // Excel/Lotus 123 ada bug tanggal 29-02-1900. 1900 bukan kabisat tapi dianggap iya

if ($nSerialDate == 60)

{

$nDay    = 29;

$nMonth    = 2;

$nYear    = 1900;

return;

}

else if ($nSerialDate < 60)

{

        // Karena tanggal 29-02-1900 itu bug, mangkanya serial date dibawah 60 di-off

$nSerialDate++;

}

// Modifikasi perhitungan Julian ke DMY dengan tambahan 2415019

$l = $nSerialDate + 68569 + 2415019;

$n = intval(( 4 * $l ) / 146097);

$l = $l – intval(( 146097 * $n + 3 ) / 4);

$i = intval(( 4000 * ( $l + 1 ) ) / 1461001);

$l = $l – intval(( 1461 * $i ) / 4) + 31;

$j = intval(( 80 * $l ) / 2447);

$nDay = $l – intval(( 2447 * $j ) / 80);

$l = intval($j / 11);

$nMonth = $j + 2 – ( 12 * $l );

$nYear = 100 * ( $n – 49 ) + $i + $l;

return $nDay.’-‘.$nMonth.’-‘.$nYear;

}

silahken dicoba.. saya ngga jamin 100% berhasil.. tapi biasanya normal aja jalan

untuk format tanggal bisa seperti contoh atau tahun-bulan-tanggal.

Author: Dewantara Mata Dunia

Indonesian Cyber Center

2 responses to “Mengubah Format Serial Date Excel ke SQL / PHP”

  1. I’m not sure exactly why but this site is loading
    very slow for me. Is anyone else having this issue or is it a issue on my end?
    I’ll check back later on and see if the problem still exists.

  2. My brother recommended I would possibly like this blog.
    He was entirely right. This post truly made my day. You can not believe simply how much
    time I had spent for this information! Thanks!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.