project BLF > class Business Component > method DisplayDateFormat

function returns character


Parameters


itDateinputdate
icFormatinputcharacter


Internal usage


BLF
method business.DisplayDate


program code (program1/business.p)

/* ==================================================================================================== */
/* This method formats the supplied date 'itDate' in the requested format (= date format of the caller) */
/* The caller can set the date format in session using ApplicationLoginFromUI or cbsession.p            */
/* If the date format in session is not set, it will be set by Session.InitInstance to mdY/             */
/* The format is a string of 4 char                                                                     */
/*     1-3 indication of d m y                                                                          */
/*     caps = long format                                                                               */
/*     4   seperator to use                                                                             */
/* eg: itdate = 19april2014                                                                             */
/*        icFormat=dmy-    --> 19-4-14                                                                  */
/*        icFormat=MDY/    --> 04/19/2014                                                               */
/* ==================================================================================================== */

define variable cformat as character case-sensitive no-undo.

cformat = icFormat.
case cformat:
    when "d" then return string (day (itDate)).
    when "D" then return string (day (itDate),"99").
    when "m" then return string(month(itDate)).
    when "M" then return string(month(itDate),"99").
    when "y" then return string (year(itDate) modulo 100).
    when "Y" then return string (year(itDate)).
    otherwise return icFormat.
end case.