You are here: Re: How can I tell if a time was yesterday? « PHP Programming Language « IT news, forums, messages
Re: How can I tell if a time was yesterday?

Posted by lvaro G. Vicario on 08/15/07 21:48

Álvaro G. Vicario escribió:
> FFMG escribió:
>> Given a time I want to know if it is today or yesterday, (on the
>> server).
>
> function is_yesterday($timestamp){ // NOT TESTED
> $start = mktime(0, 0, 0,
> date('n', time()), date('j', time()), date('Y', time()));
> $end = mktime(0, 0, 0,
> date('n', time()), date('j', time()), date('Y', time()));
>
> return ($timestamp>=$start) && ($timestamp<$end)
> }

I'm sorry, I didn't understand the specs and my code contains a huge
type that makes it useless; $end should be;

$end = mktime(0, 0, 0, date('n', time()), date('j', time())+1, date('Y',
time()));

Anyway, I hope it can at least give some ideas...

--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor austrohúngaro: http://www.demogracia.com
--

 

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

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