Reply to Re: How can I tell if a time was yesterday?

Your name:

Reply:


Posted by gosha bine on 08/15/07 11:28

On 15.08.2007 12:54 Rik wrote:
> On Wed, 15 Aug 2007 12:41:05 +0200, gosha bine <stereofrog@gmail.com>
> wrote:
>
>> On 15.08.2007 12:26 Rik wrote:
>>> On Wed, 15 Aug 2007 12:23:52 +0200, gosha bine <stereofrog@gmail.com>
>>> wrote:
>>>
>>>> On 15.08.2007 11:57 FFMG wrote:
>>>>> Hi, Given a time I want to know if it is today or yesterday, (on the
>>>>> server).
>>>>> I cannot use time difference because if I log the time and it is
>>>>> 23:59
>>>>> and I check again at 24:01 then the earlier time is, in fact,
>>>>> yesterday.
>>>>> so given time $a and time $b how can I calculate if $a is the day
>>>>> before $b?
>>>>>
>>>>
>>>> if(unixtojd($b) - unixtojd($a) == 1)
>>>>
>>>> http://www.php.net/manual/en/function.unixtojd.php
>>> Erm, Julian days start at noon?
>>
>> Don't trust every comment you see in the manual. ;)
>
> Haven't examined the function, but I did see that comment yeah, and
> wikipedia (well, another source of blatant lies sometimes, but hey) states:
>
> <http://en.wikipedia.org/wiki/Julian_day>
> [quote] skipped
>
> Which led me to assume it to be true.
>
> Then again, the manual points at
> <http://www.hermetic.ch/cal_stud/jdn.htm>, which states there are
> several posibilities to start the day... If you say the PHP function
> takes midnight, I believe you :-)

php implementation is not that clever. It just pulls the date (year,
month, day) out of the timestamp[*] and calculates jd for this date.
It's completely unaware of times.

[*] Of course, the result of conversion depends on the local time
settings i.e. timezone and daylight saving state.



--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi

[Back to original 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

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