I have successfully converted time field to date/time. Now I need to find the total minutes between one field and another but cannot get it to show me any value. I am using DateDiff ('n',{@startdatetune}, {@startdatetime}) where n indicates minutes. I should be able to use any field where I have concatenated the date and time into one field. Right?
Software/Hardware used:
ASKED:
December 28, 2010 2:02 PM
UPDATED:
December 30, 2010 4:36 AM
Here is a simple example:
D w@Date S Z D w@Date1 S Z D w@Diff S 5P 0 /Free w@Date = %TimeStamp(); w@Date1 = w@Date - %Minutes(35); w@Diff = %Diff(w@Date :w@Date1 : *Minutes); *INLR = *On; /End-FreeThis is a complete program. w@Diff has a value of 35 which, as you can see, is the difference I entered in the previous line.
I should be able to use any field where I have concatenated the date and time into one field.
No.
You need to use fields that are appropriately defined and that have appropriate values. Show us your variable definition, the actual values in the variables and the actual statements that do the calculation.
In particular, we need to see the source for your DateDiff() procedure. Without seeing the source, we have no idea what it will do with different variables.
Tom
I didn’t notice at first that this is a RPG/400 question. In that case, you don’t have procedures available.
DateDiff (‘n’,{@startdatetune}, {@startdatetime})
So, what exactly is “DateDiff”? It’s not part of RPG/400. Where did you get it and how are you using it?
Tom
Two issues
1 – Are you using RPG/400 or RPGLE (RPG/IV)?
2 – Since DATEDiff is an SQL function – are you using SQL?.
DateDiff is not part of the SQL standard and is not a built in function in DB2
However, if you’ve actually made SQL datetime fields (no you can’t just concatenated the date and time into one field) then you could do something like this
select Minutes(dateEnd) – Minutes(dateBegin) as elapsedTime from ….
Phil
Ahh! I thought “DateDiff” seemed familiar. When I see questions where someone tries an operation from a different platform, I wonder if there is a Visual Basic forum somewhere that has a question like “I tried to use SETLL before a READE in my VB script, but I got this weird error message. Anybody know what I should change?”
Tom