|
Posted by Tyrone Slothrop on 10/13/65 11:28
On Wed, 05 Oct 2005 17:06:09 +0200, Lampa Dario <lamp@dario.it> wrote:
>Hi, this morning I have seen that the script at pagina:
>http://www.teachingonline.it/script/statistiche2.php wasn't working
>properly
>
>With this code I estract the day of the week in numeric format
>
>$data=$record['Data_Visita']; // year-month-day date format
>$anno=substr($data,1,4);
>$mese=substr($data,6,2);
>$giorno=substr($data,8,2);
>$utime = mktime (0,0,0, $mese,$giorno,$anno,-1);
>$weekday=date('w',$utime);
>if ($weekday==0)
>$weekday=7; // days from 1 to 7 (in Italian) echo $weekday;
>
>This code has worked correctly before sept 30, after this day, I should
>have had weekday=6, then 7, then 1 again, but after 5 I get 3, and so on
>
>What is the problem?
>
>Francesco
I have run into this before but cannot remember what caused it. :-(
Consider using:
http://us3.php.net/strtotime
This will convert the date of the record directly to $utime. Then you
can just use the time function to display the values.
$anno = date('Y', $utime);
etc.
Navigation:
[Reply to this message]
|