-
Hallo Brigitta
danke für den Input. Timestamdiff gefällt mir.
Kleine Nachfrage noch, wofür steht denn die 8 in 'timestampdiff(8.....'
Freundliche Grüsse
mikka_71
-
und och gebe mir die Antwort selbst. Verzeihung...
TIMESTAMPDIFF scalar function
 >>-TIMESTAMPDIFF--(--expression--,--expression--)--------------><The schema is SYSFUN.
Returns an estimated number of intervals of the type defined by the first argument, based on the difference between two timestamps.
The first argument can be either INTEGER or SMALLINT. Valid values of interval (the first argument) are:
- 1
- Fractions of a second
- 2
- Seconds
- 4
- Minutes
- 8
- Hours
- 16
- Days
- 32
- Weeks
- 64
- Months
- 128
- Quarters
- 256
- Years
The second argument is the result of subtracting two timestamps and converting the result to CHAR(22). In a Unicode database, if a supplied argument is a graphic string, it is first converted to a character string before the function is executed.
The result of the function is INTEGER. The result can be null; if the argument is null, the result is the null value.
The following assumptions may be used in estimating a difference:
- There are 365 days in a year.
- There are 30 days in a month.
- There are 24 hours in a day.
- There are 60 minutes in an hour.
- There are 60 seconds in a minute.
These assumptions are used when converting the information in the second argument, which is a timestamp duration, to the interval type specified in the first argument. The returned estimate may vary by a number of days. For example, if the number of days (interval 16) is requested for the difference between '1997-03-01-00.00.00' and '1997-02-01-00.00.00', the result is 30. This is because the difference between the timestamps is 1 month, and the assumption of 30 days in a month applies.
Example:
The following example returns 4277, the number of minutes between two timestamps:
TIMESTAMPDIFF(4,CHAR(TIMESTAMP('2001-09-29-11.25.42.483219') - TIMESTAMP('2001-09-26-12.07.58.065497'))) This topic can be found in: SQL Reference, Volume 1.
-
"30 days in a month" ist da schon ein Problem.
Die Differenz vom 28.02. 23:00 zum 01.03. 00:00 wird z.B. mit 25 Stunden ausgewiesen.
Die Funktion ist also nicht sehr hilfreich !!! <= Vergesst es
Nachtrag:
Wenn man mit 2008 testet ist das ja rchtig. In 2009 gibt er mir auch nur 1 Stunde.
In RPGLE heißt die Funktion %DIFF().
Similar Threads
-
By christian_lettner in forum NEWSboard Programmierung
Antworten: 2
Letzter Beitrag: 16-11-06, 11:15
-
By FNeurieser in forum NEWSboard Programmierung
Antworten: 3
Letzter Beitrag: 11-10-06, 15:53
-
By malzusrex in forum IBM i Hauptforum
Antworten: 8
Letzter Beitrag: 19-09-06, 12:04
-
By Kaufmann in forum IBM i Hauptforum
Antworten: 11
Letzter Beitrag: 28-06-06, 15:11
-
By loeweadolf in forum NEWSboard Programmierung
Antworten: 2
Letzter Beitrag: 01-06-06, 10:43
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- You may not post attachments
- You may not edit your posts
-
Foren-Regeln
|
Erweiterte Foren Suche
Google Foren Suche
Forum & Artikel Update eMail
AS/400 / IBM i
Server Expert Gruppen
Unternehmens IT
|
Kategorien online Artikel
- Big Data, Analytics, BI, MIS
- Cloud, Social Media, Devices
- DMS, Archivierung, Druck
- ERP + Add-ons, Business Software
- Hochverfügbarkeit
- Human Resources, Personal
- IBM Announcements
- IT-Karikaturen
- Leitartikel
- Load`n`go
- Messen, Veranstaltungen
- NEWSolutions Dossiers
- Programmierung
- Security
- Software Development + Change Mgmt.
- Solutions & Provider
- Speicher – Storage
- Strategische Berichte
- Systemmanagement
- Tools, Hot-Tips
Auf dem Laufenden bleiben
|
Bookmarks