T
Thiru
Guest
I use below program to change the date format based on the value setup in variable(cDataFormat). But the concern is this can be changed by the user and the program should act accordingly
Continue reading...
Code:
DEFINE VARIABLE cDate AS DATE NO-UNDO.
DEFINE VARIABLE clogindate AS CHARACTER NO-UNDO.
DEFINE VARIABLE cDateformat AS CHARACTER NO-UNDO INIT "YYYY/MM/DD". /*this can be changed by
user*/
cDate = DATE(11/27/2020).
IF cDateformat = "YYYY/MM/DD" THEN clogindate = string(year(cDate),"9999") +
string(month(cDate),"99") + string(day(cDate),"99").
ELSE IF cDateformat = "YY/MM/DD" THEN clogindate = string(year(cDate),"99") +
string(month(cDate),"99") + string(day(cDate),"99").
ELSE IF cDateformat = "MM/DD/YY" THEN clogindate = string(month(cDate),"99") +
string(day(cDate),"99") + string(year(cDate),"9999").
/* AND SO ON...... as you know writing so much lines not the smartest way..Please give any idea*/
DISP clogindate.
Continue reading...