When I use this function in excel
=MOD("06/03/1992";7)
it returns 6
How to make the function in PHP? I try this code in PHP, but the result is different
$today = strtotime("06-03-1992");
$mod = ($today/86400) % 7;
echo $mod;
//return 0
Thanks
When I use this function in excel
=MOD("06/03/1992";7)
it returns 6
How to make the function in PHP? I try this code in PHP, but the result is different
$today = strtotime("06-03-1992");
$mod = ($today/86400) % 7;
echo $mod;
//return 0
Thanks
The problem is you calculate with 2 different numbers:
strtotime returns the UNIX timestamp in seconds; dividing it [as you did] by 86'400 returns 8'188.As you can see the values don't match.
I refer to this post which describes how to convert an Excel Date to Unix timestamp. This should fix your problem.