5

I am coding in Progress (aka OpenEdge ABL).

I have a variable that holds a time and I want to figure out if it is greater than the current time.
But I cannot find anything in the documentation I've read that shows me how to retrieve the current Time in Progress.
I can only find information about retrieving the current Date (using the Today keyword).
Incidentally, if using the Today keyword includes the time portion of the date, that's fine, but then I would need to know how to isolate just the time portion.

Thanks. (Note that the time I'm referring to is of the type that is an integer representing the seconds since midnight)

doydoy44
  • 5,720
  • 4
  • 29
  • 45
user2592449
  • 51
  • 1
  • 1
  • 3

2 Answers2

13

Prior to version 10:

define variable t as integer no-undo.  /* time, in seconds, since midnite */

t = time.

display t.

After version 10 (if you want combined date & time):

define variable dt as datetime no-undo.

dt = now.

display dt.

Comparing an existing time variable to the current time:

define variable t as integer no-undo initial 12345.  /* 3:25:45 am */

display t > time.

Extract the time, in seconds, from a DateTime variable (and display it nicely as Jensd suggests):

define variable t  as integer  no-undo.
define variable dt as datetime no-undo.

dt = now.

t = integer( mtime( dt ) / 1000 ).

display t string( t, "hh:mm:ss am" ).
Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
  • 3
    If you want to display the time in a more human readable fashion you can do `DISPLAY STRING(TIME,"HH:MM:SS")`. – Jensd Jul 18 '13 at 08:25
  • Good idea, I'll add it to the answer. – Tom Bascom Jul 18 '13 at 15:53
  • thank you! seems so obvious, but I have never worked with progress before - or any database that treats time in this manner. And all the documentation I could find must have been from the newer version because all answers were pointing towards the combined datetime solution. – user2592449 Jul 18 '13 at 17:18
  • At the bottom of each doc entry in the PDF's there's a list of "related" command that you can check out. – Tim Kuehn Jul 18 '13 at 17:26
0
DISPLAY STRING(TIME,'HH:MM:SS').
blackgreen
  • 34,072
  • 23
  • 111
  • 129