You are here: Re: mktime function isn't working properly « PHP Language « IT news, forums, messages
Re: mktime function isn't working properly

Posted by Stefan Rybacki on 09/28/44 11:28

Lampa Dario 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);

Better read the manual. Your start indices in the string are wrong! Strings starting at
position 0 so your substr functions have to look like this:

$anno=substr($data,0,4);
$mese=substr($data,5,2);
$giorno=substr($data,8,2);


Regards
Stefan

> $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
>

 

Navigation:

[Reply to this 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

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