Page 1 of 1

PHP Challenge

Posted: Tue Jun 01, 2004 11:57 am
by Neonfire
I know, this is more a technical issue but I want to reach as most people as possible to help us for a solution.

In order to implement the Illarion time system into the client as well as into the homepage I created a little PHP script to convert dates from RL time to the Illarion time.

The script is commented in German, as well as the output is German language only.

And now I am looking for some PHP wizards around to create a script doing exactly the same vice-versa, I mean from Illarion date to RL date.

Maybe a little challenge for you to support us. :D

Running version and source code below German text.

---

Ich weiss, eigentlich gehört das hier eher ins Technik-Forum, aber mein Ziel ist es, möglichst viele PHP-Kenner zu erreichen, um die möglichst beste Lösung zu finden.

Für die Implementation des neuen Zeitsystems hab ich vor einiger Zeit ein PHP-Skript geschrieben, um RL-Zeiten in Illarion-Zeiten umzuwandeln.

Nun, das Skript selbst ist kommentiert und auch so funktionsfähig.

Nur bin ich auf der Suche nach einer umgekehrten Lösung, die mir aus dem Illarion-Datum eine RL-Zeit ausgibt. Vielleicht gibts ja unter Euch ein PHP-Genie, dass nicht so ewig grübelt (wie ich) bis es zu ner Lösung kommt.

Deshalb hier der Sourcecode und die lauffähige Version.

---

Running Version

Sourcecode date.php

Sourcecode getdate.php.inc

Posted: Sat Jun 05, 2004 4:32 pm
by Armil Darken
Heh. I'm working on it. Probably wont get done, and it'll be in english. :Prays to google:

Posted: Sat Jun 05, 2004 5:49 pm
by Armil Darken
:points at grammatically incorrect english version: http://members.lycos.co.uk/drowguildkuel/date.php

Posted: Sun Jun 06, 2004 5:47 pm
by Neonfire
Yes ... RL date to Illa date is what I have done before. But how about a script working vice-versa ... I mean Illa date to RL date.

Can you do this?

Posted: Sun Jun 06, 2004 10:51 pm
by Cedric Kilmar
Hallo!

Also... erstens Mal bin ich kein PHP Genie ;)
Aber ich habs trotzdem mal versucht.

Ich bin leider noch nicht ganz fertig, aber da ich Morgen für eine Woche weg bin dachte ich ich zeig mal wie weit ich gekommen bin. Vielleicht hilft es euch ja ein bisschen, wenn nicht könnt ihr das Post gerne wieder löschen.

Eingabemaske
Code
Quellcode

mfg PO Cedric Kilmar :)

P.S. Bei Fragen oder Kritik --> Hier oder per Mail

Posted: Mon Jun 07, 2004 12:25 am
by Neonfire
Last one looks nice, although it doesn't calculate the right date ;-)

This problem is more of mathematical nature than a PHP problem.

Posted: Mon Jun 07, 2004 2:05 pm
by martin
Du nimmst das IllaDatum zur Hand und:

Multiplizierst

IllaJahr * SekundenProIllaJahr = IllaJahreInSekunden

(SekundenProIllaJahr = SekundenProJahr / Multiplikator)

Dann rechnest du die Anzahl der IllaTage aus, die die vergangenen IllaMonate "verschlungen" haben (15 * AnzahlVergangenerIllaMonate)

Dann zaehlst du dazu die Anzahl des Aktuellen IllaTages (minus 1)

Dann hast du darin die Anzahl der IllaTage, die dieses Jahr bereits ganz vergangen sind. Diese Zahl multiplizierst du mit der Zahl der SekundenProIllaTag (=SekundenProTag/Multiplikator)

Dann nimmst du die IllaStunden, die an diesem IllaTag bereits vergangen sind, und Multiplizierst sie mit SekundenProIllaStunde.

Ich weiss nicht, wie fein die Untergliederung weitergeht, das Muster sollte klar sein.

Am Ende addierst du diese ganzen Zahlen zusammen und hast so die Sekunden seit dem Startdatum (17.2.2000).
Das kannst du dann leicht umrechnen in was du willst.

HTH,

Martin