Ashwani Mishra
New Member
Hello There,
Below code show 2 different output for input date. If I pass blank date to function and concatenate the output of funstion to another string, it returns ?. Where as if I simply concatenate 1 string with character "?" it shows the output. Can someone please explain the reason? thanks!
OS - Window 7, Above code checked in OE10.2B, 11.4
Below code show 2 different output for input date. If I pass blank date to function and concatenate the output of funstion to another string, it returns ?. Where as if I simply concatenate 1 string with character "?" it shows the output. Can someone please explain the reason? thanks!
OS - Window 7, Above code checked in OE10.2B, 11.4
Code:
DEF VAR cal AS CHAR FORMAT "x(3)" EXTENT 12
INITIAL ["JAN", "FEB", "MAR", "APR", "MAY",
"JUN", "JUL", "AUG", "SEP", "OCT",
"NOV", "DEC"].
DEF VAR d-monddyyyy AS CHAR FORMAT "x(15)" NO-UNDO.
DEF VAR dtblank AS DATE INIT ?.
DEF VAR dt-date AS DATE INIT 08/21/2017.
FUNCTION NiceDate RETURNS CHARACTER
(ipDate AS DATE ) FORWARD.
d-monddyyyy = NiceDate(dtblank) .
MESSAGE "Date blnk: " + d-monddyyyy
VIEW-AS ALERT-BOX.
MESSAGE "Date : " + "?"
VIEW-AS ALERT-BOX.
d-monddyyyy = NiceDate(dt-date) .
MESSAGE "Date : " + d-monddyyyy
VIEW-AS ALERT-BOX.
FUNCTION NiceDate RETURNS CHARACTER
(ipDate AS DATE ):
/*------------------------------------------------------------------------------
Purpose:
Notes:
------------------------------------------------------------------------------*/
DEFINE VARIABLE chBetterDate AS CHARACTER NO-UNDO.
chBetterDate = cal[MONTH(ipdate)] + " "
+ string(DAY (ipDate), "99") + ","
+ string(YEAR(ipDate), " 9999").
RETURN chBetterDate.
END FUNCTION.