You are here: Re: [PHP] Help with dates « PHP « IT news, forums, messages
Re: [PHP] Help with dates

Posted by Richard Lynch on 10/04/48 11:10

>> > Right now I'm working on a script that would calculate dates from one
>> > calendar to another. The normal calendar we use and a newly invented
> one.
>>
>> [shudder]
>> There are already WAY too many calendar systems.
>>
>> Inventing a new one is probably not such a good plan...
>>
>> Why re-invent the wheel?
>
> It's part of a game. In the RPG there are dates which the players would
> like
> to be able to convert from our calendar to that one, and back again..

You'll be way better off finding an existing calendar that "fits" your
criteria than inventing a new one.

>> But you didn't define how far into the future you need to go.
>> Current time?
>> A few years out?
>> Stardates from Star Trek?
>> You have to specify a start date, end date, and accuracy to choose a
>> correct calendar system.
>
> It's mostly the past. The RPG is set in Egypt and the beginning of the
> society in egypt has been taken as year 0. The start date I think is
> obvious, but I do not understand an end date of a calendar.. Perhaps I'm
> just blond.. but could you perhaps explain that one?

Here's your IDEAL calendar:

Your start date is 0 BC.

So let's make that be represented by: 0
Day 1 is, errr, December 26, 0 BC, represented by: 1
Day 2, December 27, 0 BC, represented by: 3
..
..
..

You can now calculate what's 2 billion+ (0xFFFFFFFF to be precise) days
later, and that would be the last date you could conveniently represent in
a 32-bit integer.

Do you expect the characters/events in your RPG to extend beyond 2 billion
days from December 25, 0 BC?

If so, then a 32-bit integer, one integer per day, simply won't cut it.

If not, then the above is an "ideal" date system.

Now, that was your "ideal" system. Find a system that comes close to that.

http://mysql.com
http://postgresql.org

PS Historians are ready to shoot me for using 12/25/0000 as 0 BC, but
that's their problem, not mine. It's an RPG. We're not looking for
historical accuracy here!

--
Like Music?
http://l-i-e.com/artists.htm

 

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

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