Question
PHP Help
I thought I posted something about this last night, but I'm
not seeing it.
http://demo.mediachurch.com/calendarlist.php
I have the following function that takes a Unix timestamp and converts it to
an (excel) serial date
define('EPOCHINEXCEL', 25568);
function priivaUnix2Excel($g) {
return mktime (0, 0, 0, 1, $g + EPOCHINEXCEL, 1970);
}
However, when I call it using this code:
$tester = priivaUnix2Excel($priivaDateToday);
echo "<p> priivaDateToday Unix to Excel: $tester</p>";
It returns a negative number.
I know the value it's getting fed is positive, b/c in the line above it I
have this:
echo "<p> PriivaDateToday(time function): $priivaDateToday </p>";
which is set by this:
$priivaDateToday = time();
and outputs "1146152298 "
So, what my function should be saying is this:
return mktime (0, 0, 0, 1, 1146452298 + 25568, 1970);
How am I ending up with a negative value?!? When I print out the values
fed, they're allshowing positive.
Any help is appreciated.
--
Thank you,
Jon Parkhurst
PriivaWeb
PO Box 1114
Sedalia, MO 65302-1114
660.826.5600
http://demo.mediachurch.com/calendarlist.php
I have the following function that takes a Unix timestamp and converts it to
an (excel) serial date
define('EPOCHINEXCEL', 25568);
function priivaUnix2Excel($g) {
return mktime (0, 0, 0, 1, $g + EPOCHINEXCEL, 1970);
}
However, when I call it using this code:
$tester = priivaUnix2Excel($priivaDateToday);
echo "<p> priivaDateToday Unix to Excel: $tester</p>";
It returns a negative number.
I know the value it's getting fed is positive, b/c in the line above it I
have this:
echo "<p> PriivaDateToday(time function): $priivaDateToday </p>";
which is set by this:
$priivaDateToday = time();
and outputs "1146152298 "
So, what my function should be saying is this:
return mktime (0, 0, 0, 1, 1146452298 + 25568, 1970);
How am I ending up with a negative value?!? When I print out the values
fed, they're allshowing positive.
Any help is appreciated.
--
Thank you,
Jon Parkhurst
PriivaWeb
PO Box 1114
Sedalia, MO 65302-1114
660.826.5600