Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
Autor |
Nachricht |
Folker •---->


Anmeldedatum: 11.12.2000 Beiträge: 649 Wohnort: Holsteinische Schweiz
|
Verfasst am: 14.06.2001 - 18:05 Titel: AppleScript rechnet Datum richtig bis? |
|
|
Hallo Scripter,
kann mir einer definitiv sagen von welchem und bis zu welchem Jahr AppleScript Datumsberechnungen richtig vornimmt. Da es bei verschiedenen AS-Versionen ja unterschiedlich sein kann, grenze ich die Frage auf die Vers. 1.3x bis heute ein - also MacOS 8.5 bis 9.1 (Classic).
Gruß,
Folker _________________ Gruß,
Folker Brandt
=============================
Systemberatung · Datenbanken · Webdesign |
|
Nach oben |
|
 |
Jens Hoffmann •--->

Anmeldedatum: 07.05.2001 Beiträge: 175
|
Verfasst am: 15.06.2001 - 10:27 Titel: AppleScript rechnet Datum richtig bis? |
|
|
Hallo Folker
Genau kann ich Dir das nicht sagen, aber hier der Abschnitt aus dem "AppleScript Language Guide":
---------------------
AppleScriptís support for dates is based on the same operating system utilities
other Macintosh applications use. Mac OS date and time utilities have correctly
handled issues related to the year 2000 since the introduction of the Macintosh.
The original date and time utilities, introduced with the Macintosh 128K in
1984, use a 32-bit value to store seconds, starting at 12:00:00 a.m., January 1,
1904 and extending to 6:28:15 a.m. on February 6, 2040.
More recent date and time utilities use a 64-bit signed value that can represent
dates from 30081 B.C. to 29940 A.D. However, AppleScript currently will not
handle dates before 1/1/1000 or after 12/31/9999. For more information on
Mac OS date and time utilities, see Inside Macintosh: Operating System Utilities,
available at the Apple Developer website:
<http://www.apple.com/developer/>
-------------------
Two-digit dates near the year 2000, or any century boundary, may still represent
a problem if your script accepts two-digit dates as text from applications or
users. Whenever your script calls on AppleScript to convert a two-digit date to
a Date value, AppleScript converts the text representation to a full date for
internal storage, following the rules illustrated in Figure 6-1 and summarized
here:
n If the current year is late in any century (years 91 to 99)
n a date with a year value from 11 to 99 is in the current century (in 1999, for
example, 11 = 1911 and 99 = 1999)
n a date with a year value from 00 to 10 is in the next century (in 1999, for
example, 03 = 2003)
n If the current year is early in any century (years 00 to 10)
n a date with a year value from 00 to 90 is in the current century (in 2000, for
example, 00 = 2000, 45 = 2045, and 90 = 2090)
n a date with a year value from 90 to 99 is in the previous century (in 2000,
for example, 99 = 1999)
n If the current year is in the middle of any century (years 11 to 90)
n a date with any value for year value, from 00 to 99, is in the current
century (in 2011, for example, 00 = 2000, 45 = 2045 and 99 = 2099)
So a script that uses nearby dates, such as for office scheduling or other
near-term planning, can use two-digit dates with some degree of safety.
However, a script that does long-term date calculations, such as for genealogy
or mortgages, should require four-digit dates. |
|
Nach oben |
|
 |
Folker •---->


Anmeldedatum: 11.12.2000 Beiträge: 649 Wohnort: Holsteinische Schweiz
|
Verfasst am: 15.06.2001 - 11:55 Titel: AppleScript rechnet Datum richtig bis? |
|
|
Hallo Jens,
danke für Deine Mühe - da muß ich mich jetzt mal durchwühlen - wobei ich date-calculations bis ins Jahr 2170 schon fehlerfrei? hinbekommen habe.
Gruß,
Folker _________________ Gruß,
Folker Brandt
=============================
Systemberatung · Datenbanken · Webdesign |
|
Nach oben |
|
 |
Jens Hoffmann •--->

Anmeldedatum: 07.05.2001 Beiträge: 175
|
Verfasst am: 15.06.2001 - 12:02 Titel: AppleScript rechnet Datum richtig bis? |
|
|
Na, dann bleiben Dir ja nur noch 29940 Jahre, bis Du an die Systemgrenze gelangst
Viel Spaß, Jens |
|
Nach oben |
|
 |
Folker •---->


Anmeldedatum: 11.12.2000 Beiträge: 649 Wohnort: Holsteinische Schweiz
|
Verfasst am: 15.06.2001 - 12:36 Titel: AppleScript rechnet Datum richtig bis? |
|
|
Hallo Jens,
naja, das Problem ist nur, dass die Berechnung des Osterdatums (aus dem sich viele bewgl. Feiertage ableiten) theoretisch bis ca. zum Jahre 8700 möglich ist - nur AS, wie in einem Posting von mir hier im Forum angesprochen, in einigen Jahren Fehler produziert siehe Thread "Obskurer Bug?!"
> daß nur die Jahre 2176, 3537, 4898, 6123, 6259 und 7484 in einer Reihe von 1583 - 8702 Ö Fehler auftreten
Gruß,
Folker _________________ Gruß,
Folker Brandt
=============================
Systemberatung · Datenbanken · Webdesign |
|
Nach oben |
|
 |
Jens Hoffmann •--->

Anmeldedatum: 07.05.2001 Beiträge: 175
|
Verfasst am: 15.06.2001 - 13:32 Titel: AppleScript rechnet Datum richtig bis? |
|
|
Kannst Du mir mal die Zeile
log x + (3000 * days)
genauer erklären? Heisst dies, es werden 3000 Tage zum aktuellen Datum hinzugezählt? Warum war dann aber beim Problem im Thread "obskurer Bug?" die Uhrzeit unterschiedlich (00:00:00 --> 17:31:44)?
Gruß, Jens |
|
Nach oben |
|
 |
Folker •---->


Anmeldedatum: 11.12.2000 Beiträge: 649 Wohnort: Holsteinische Schweiz
|
Verfasst am: 15.06.2001 - 14:15 Titel: AppleScript rechnet Datum richtig bis? |
|
|
Hallo Jens,
das Posting mit der Zeile
log x + (3000 * days)
war von Snow, aber richtig, es werden 3000 Tage zu einem Datum x dazugerechnet.
Mein Posting enthielt folgende Zeilen, Kommentare sind jetzt neu für Dich dazugeschrieben.
-- Datum "1.1.2176"
set x to date "Montag, 1. Januar 2176 0:00:00 Uhr"
-- zu Datum x werden insgesamt 90 Tage addiert
log (x + ((31 + 29 + 30) * days))
AppleScript haut mir als Ergebnis folgendes raus (Ja, die Uhrzeit ist schon ein Beleg für den Fehler! - aber vor allem die Jahreszahl!!)
--result: date "Mittwoch, 22. Februar 2040 17:31:44 Uhr"
Viele Grüße,
Folker
PS: Achso, mit 'log' kannst Du während der Ausführung eines Scriptes Zwischen-results ins Worksheet des ScriptEditors "Smile" schreiben (funktioniert wohl auch in anderen Editoren mit Event-Protokollen o.ä. - aber diese habe ich schon so lange nicht mehr zum Scripten benutzt - kann also gar nicht mehr sagen wie die genau funktionieren ) _________________ Gruß,
Folker Brandt
=============================
Systemberatung · Datenbanken · Webdesign |
|
Nach oben |
|
 |
|
|
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen.
|
Powered by phpBB © 2001, 2002 phpBB Group Deutsche Übersetzung von phpBB.de
|
|
|