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

Your name:

Reply:


Posted by Rik on 08/15/07 10:54

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 t=
he
>>>> 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) =3D=3D 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) stat=
es:

<http://en.wikipedia.org/wiki/Julian_day>
[quote]
The Julian day or Julian day number (JDN) is the integer number of days =
=

that have elapsed since the initial epoch defined as noon Universal Time=
=

(UT) Monday, January 1, 4713 BC in the proleptic Julian calendar [1]. Th=
at =

noon-to-noon day is counted as Julian day 0. Thus the multiples of 7 are=
=

Mondays. Negative values can also be used, although those predate all =

recorded history.

Now at 00:20, Friday August 10, 2007 (UTC) the JDN is 2454322. The =

remainder of this value divided by 7 is 3, an integer expression for the=
=

day of the week with 0 representing Monday.

The Julian date (JD) is a continuous count of days and fractions elapsed=
=

since the same initial epoch. Currently the JD is 2454322.51389. The =

integral part (its floor) gives the Julian day number. The fractional pa=
rt =

gives the time of day since noon UT as a decimal fraction of one day or =
=

fractional day, with 0.5 representing midnight UT. Typically, a 64-bit =

floating point (double precision) variable can represent an epoch =

expressed as a Julian date to about 1 millisecond precision.
[/quote]

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 severa=
l =

posibilities to start the day... If you say the PHP function takes =

midnight, I believe you :-)
-- =

Rik Wasmus

[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

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