newbie: date/time functions problems
newbie: date/time functions problems
am 28.12.2007 19:00:00 von r_ahimsa_m
Hello,
I am making my first website in PHP5 and I have a problem with date/time
functions.
I have written (in Scripts.inc PHP file):
function Footer()
{
echo date('Y.m.d', filemtime($_SERVER['PHP_SELF'])); // this is line
201
}
to print in footer last modification date of current page.
Unfortunately I receive errors:
Warning: filemtime() [function.filemtime]: stat failed for
/StowarzyszenieIntegracja/Club.php in
F:\Inetpub\wwwroot\StowarzyszenieIntegracja\Scripts.inc on line 201
Strict Standards: date() [function.date]: It is not safe to rely on the
system's timezone settings. Please use the date.timezone setting, the TZ
environment variable or the date_default_timezone_set() function. In case
you used any of those methods and you are still getting this warning, you
most likely misspelled the timezone identifier. We selected 'Europe/Paris'
for '1.0/no DST' instead in
F:\Inetpub\wwwroot\StowarzyszenieIntegracja\Scripts.inc on line 201
I don't understand this errors. Could you help me?
/RAM/
Re: newbie: date/time functions problems
am 28.12.2007 22:38:38 von nc
On Dec 28, 10:00 am, "R.A.M." wrote:
>
> I am making my first website in PHP5 and I have a problem with
> date/time functions.
> I have written (in Scripts.inc PHP file):
> function Footer()
> {
> echo date('Y.m.d', filemtime($_SERVER['PHP_SELF'])); // this is line
> 201}
>
> to print in footer last modification date of current page.
> Unfortunately I receive errors:
>
> Warning: filemtime() [function.filemtime]: stat failed for
> /StowarzyszenieIntegracja/Club.php in
> F:\Inetpub\wwwroot\StowarzyszenieIntegracja\Scripts.inc on line 201
>
> Strict Standards: date() [function.date]: It is not safe to rely on the
> system's timezone settings. Please use the date.timezone setting, the TZ
> environment variable or the date_default_timezone_set() function. In case
> you used any of those methods and you are still getting this warning, you
> most likely misspelled the timezone identifier. We selected 'Europe/Paris'
> for '1.0/no DST' instead in
> F:\Inetpub\wwwroot\StowarzyszenieIntegracja\Scripts.inc on line 201
>
> I don't understand this errors. Could you help me?
Try this:
date_default_timezone_set('Europe/Warsaw');
echo date('Y.m.d', filemtime($_SERVER['SCRIPT_FILENAME']));
Cheers,
NC
Re: newbie: date/time functions problems
am 31.12.2007 08:33:39 von r_ahimsa_m
Uzytkownik "NC" napisal w wiadomosci
news:ccc06640-7dad-442c-bb24-879628d0e1f2@e25g2000prg.google groups.com...
> Try this:
>
> date_default_timezone_set('Europe/Warsaw');
> echo date('Y.m.d', filemtime($_SERVER['SCRIPT_FILENAME']));
Thank you, but...
Now I have:
Warning: filemtime() [function.filemtime]: stat failed for
/StowarzyszenieIntegracja/Association.php in
F:\Inetpub\wwwroot\StowarzyszenieIntegracja\Scripts.inc on line 217
Re: newbie: date/time functions problems
am 01.01.2008 11:32:44 von nc
On Dec 30 2007, 11:33 pm, "R.A.M." wrote:
> Uzytkownik "NC" napisal...
>
> > Try this:
>
> > date_default_timezone_set('Europe/Warsaw');
> > echo date('Y.m.d', filemtime($_SERVER['SCRIPT_FILENAME']));
>
> Thank you, but...
> Now I have:
>
> Warning: filemtime() [function.filemtime]: stat failed
> for /StowarzyszenieIntegracja/Association.php in
> F:\Inetpub\wwwroot\StowarzyszenieIntegracja\Scripts.inc
> on line 217
At least we got rid of the date() warning... Oh well, let's get
radical:
date_default_timezone_set('Europe/Warsaw');
echo date('Y.m.d', filemtime(__FILE__));
The problem with this approach is that it will display modification
time for Scripts.inc rather than Association.php... Can you live with
that?
Cheers,
NC
Re: newbie: date/time functions problems
am 01.01.2008 13:18:18 von r_ahimsa_m
Uzytkownik "NC" napisal w wiadomosci
news:b99743fc-adb5-4c45-bd09-c022b604eddf@i12g2000prf.google groups.com...
> The problem with this approach is that it will display modification
> time for Scripts.inc rather than Association.php... Can you live with
> that?
No, it is not a good solution in my case. Include file Scripts.inc is used
in a few independent .php pages and I want to show modification date of each
of them.
I cannot simply forget about warning because the date shown is 1970.01.01
and it is not correct.
/RAM/