You are here: Re: To cange the last modidied date of a file « PHP Programming Language « IT news, forums, messages
Re: To cange the last modidied date of a file

Posted by Pedro Graca on 01/20/06 14:17

Steel wrote:
>
> $FileName="myfile.txt";
> $Today =strtotime('2006-01-20 00:00:00');
> touch($FileName,$Today)
>
>
> It work
>
> Now I want to add 24hours to the new last modified date without to know any
> time what is the date but knowing that the last modified date must be always
> have the time set to 00:00:00

Hmmm ... what date do you want a file last modified on
2006-01-20 00:00:01
changed to?

What if is has been last modified on
2006-01-20 23:59:59

> I.e.:
> How can I do?

clearstatcache();
$origtime = getdate(filemtime($FileName));
$newtime = mktime(0, 0, 0, $origtime['mon'], 1+$origtime['mday'], $origtime['year']);

### answer the questions above and either uncomment or remove the
### following line
// $newtime += 24*60*60;

touch($FileName, $newtime);


You may have some problems when DST starts/ends. Perhaps you can use
gmmktime() instead.

--
If you're posting through Google read <http://cfaj.freeshell.org/google>

 

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

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