• Optimize date2str function


    /***************************************************
    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,#123,#2,_separator,#2,_separator,#2); break;
            case DNT_DateFormatExtended::ddmmyyyy:  ret = date2str(_dateValue,#123,#2,_separator,#2,_separator,#4); break;
            case DNT_DateFormatExtended::ddyymm:    ret = date2str(_dateValue,#132,#2,_separator,#2,_separator,#2); break;
    
            case DNT_DateFormatExtended::ddyyyymm:  ret = date2str(_dateValue,#132,#2,_separator,#2,_separator,#4); break;
            case DNT_DateFormatExtended::mmddyy:    ret = date2str(_dateValue,#213,#2,_separator,#2,_separator,#2); break;
            case DNT_DateFormatExtended::mmddyyyy:  ret = date2str(_dateValue,#213,#2,_separator,#2,_separator,#4); break;
            case DNT_DateFormatExtended::mmyydd:    ret = date2str(_dateValue,#231,#2,_separator,#2,_separator,#2); break;
            case DNT_DateFormatExtended::mmyyyydd:  ret = date2str(_dateValue,#231,#2,_separator,#2,_separator,#4); break;
            case DNT_DateFormatExtended::yyddmm:    ret = date2str(_dateValue,#312,#2,_separator,#2,_separator,#2); break;
            case DNT_DateFormatExtended::yyyyddmm:  ret = date2str(_dateValue,#312,#2,_separator,#2,_separator,#4); break;
            case DNT_DateFormatExtended::yymmdd:    ret = date2str(_dateValue,#321,#2,_separator,#2,_separator,#2); break;
            case DNT_DateFormatExtended::yyyymmdd:  ret = date2str(_dateValue,#321,#2,_separator,#2,_separator,#4); break;
        }
    
        return ret;
    }
  • 相关阅读:
    从一个表中查数据,插入另一个表
    sql 字段字符串内容替换
    安装VS2010后,如何设置老版本的项目文件不是默认用VS2010打开
    题解 [JOI 2019 Final] 独特的城市
    题解 [JOI 2019 Final] 硬币收藏
    题解 [CF720A] Closing ceremony
    [学习笔记] Miller-Rabin 质数测试
    题解 [CF332C] Students' Revenge
    题解 [CF525D] Arthur and Walls
    SpringMVC-拦截器
  • 原文地址:https://www.cnblogs.com/Fandyx/p/3200095.html
Copyright © 2020-2023  润新知