Reply to Re: Integer date to readable dates

Your name:

Reply:


Posted by Ewoud Dronkert on 12/08/05 23:09

Sjoerd wrote:
> number of days since 1-1-1900

Of course! I missed a decimal, and thought: "Hmm what could it be, number
of days since 1995 somewhere?!"

Unfortunately mktime(0, 0, 0, 1, 38694, 1900) doesn't work (on Windows
anyway), so use an offset:

define('EPOCHINEXCEL', 25568); //01-01-1970 minus 1

function excel2unix($n) {
return mktime(0, 0, 0, 1, $n - EPOCHINEXCEL, 1970);
}

$myexceldate = 38694; //today
echo date('d-m-Y', excel2unix($myexceldate)); //prints 08-12-2005

You may want to extend the function to handle fractions (time of day).

--
E. Dronkert

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация