Optimize date2str function

时间:2021-07-13 01:06:28
/***************************************************
Created Date: 19 Jul 2013
Created By: Jimmy Xie (Tectura)
Helpdesk Ticket#: TB001613 - Accounts Payable Positive Pay
Description of Behavior: Format extended date
Expected Input:
Expected Output:
***************************************************/
public static str dateFormatExtended2Str_DNT(Date _dateValue,
DNT_DateFormatExtended _dateFormatExtended,
int _separator)
{
#define.123 (123)
#define.132 (132)
#define.213 (213)
#define.231 (231)
#define.312 (312)
#define.321 (321)
#define.0 (0)
#define.2 (2)
#define.4 (4) str ret;
; switch(_DateFormatExtended)
{
case DNT_DateFormatExtended::ddmmyy: ret = date2str(_dateValue,#,#,_separator,#,_separator,#); break;
case DNT_DateFormatExtended::ddmmyyyy: ret = date2str(_dateValue,#,#,_separator,#,_separator,#); break;
case DNT_DateFormatExtended::ddyymm: ret = date2str(_dateValue,#,#,_separator,#,_separator,#); break; case DNT_DateFormatExtended::ddyyyymm: ret = date2str(_dateValue,#,#,_separator,#,_separator,#); break;
case DNT_DateFormatExtended::mmddyy: ret = date2str(_dateValue,#,#,_separator,#,_separator,#); break;
case DNT_DateFormatExtended::mmddyyyy: ret = date2str(_dateValue,#,#,_separator,#,_separator,#); break;
case DNT_DateFormatExtended::mmyydd: ret = date2str(_dateValue,#,#,_separator,#,_separator,#); break;
case DNT_DateFormatExtended::mmyyyydd: ret = date2str(_dateValue,#,#,_separator,#,_separator,#); break;
case DNT_DateFormatExtended::yyddmm: ret = date2str(_dateValue,#,#,_separator,#,_separator,#); break;
case DNT_DateFormatExtended::yyyyddmm: ret = date2str(_dateValue,#,#,_separator,#,_separator,#); break;
case DNT_DateFormatExtended::yymmdd: ret = date2str(_dateValue,#,#,_separator,#,_separator,#); break;
case DNT_DateFormatExtended::yyyymmdd: ret = date2str(_dateValue,#,#,_separator,#,_separator,#); break;
} return ret;
}