Kbase P75847: How to extract the TIME portion from a DATETIME or DATETIME-TZ field
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  12/9/2010 |
|
Status: Verified
GOAL:
How to extract the TIME portion from a DATETIME field
GOAL:
How to extract the TIME portion from a DATETIME-TZ field
GOAL:
How to extract only the time portion of a datetime variable
FACT(s) (Environment):
OpenEdge 10.x
All Supported Operating Systems
FIX:
DEF VAR tsdate AS DATETIME.
/* Put a datetime value in tsdate variable */
ASSIGN tsdate = DATETIME( TODAY, MTIME ).
/* equivalent to Assign tsdate = NOW. */
/* display the time portion of the datetime variable with format HH:MM:SS:NNN where NNN are the milliseconds */
DISPLAY tsdate
STRING( INTEGER( truncate( MTIME( tsdate ) / 1000, 0 ) ), "HH:MM:SS" ) + ":" + STRING( MTIME(tsdate) MODULO 1000, "999" ) FORMAT "x(16)".